feat: 轮播图大小
This commit is contained in:
parent
80eaad039e
commit
9d1c4c9744
@ -1,6 +1,6 @@
|
|||||||
import { Counter, UserCountData } from "@/types/user";
|
import { Counter, UserCountData } from "@/types/user";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Dimensions, StyleSheet, View } from "react-native";
|
import { Dimensions, StyleSheet, View, ViewStyle } from "react-native";
|
||||||
import { useSharedValue } from "react-native-reanimated";
|
import { useSharedValue } from "react-native-reanimated";
|
||||||
import Carousel, {
|
import Carousel, {
|
||||||
ICarouselInstance
|
ICarouselInstance
|
||||||
@ -72,21 +72,31 @@ function CarouselComponent(props: Props) {
|
|||||||
mode="parallax"
|
mode="parallax"
|
||||||
onProgressChange={progress}
|
onProgressChange={progress}
|
||||||
defaultIndex={carouselDataValue?.findIndex((item) => item?.key === 'total_count') - 1 || 0}
|
defaultIndex={carouselDataValue?.findIndex((item) => item?.key === 'total_count') - 1 || 0}
|
||||||
renderItem={({ item }) => {
|
renderItem={({ item, index }) => {
|
||||||
if (item?.key === 'total_count') {
|
const style: ViewStyle = {
|
||||||
return totleItem(item.value)
|
marginHorizontal: 10,
|
||||||
}
|
width: '92%',
|
||||||
return CategoryComponent(
|
height: '92%',
|
||||||
{
|
};
|
||||||
title: item?.key,
|
return (
|
||||||
data:
|
<View key={index} style={style}>
|
||||||
[
|
{item?.key === 'total_count' ? (
|
||||||
{ title: 'Video', number: item?.value?.video_count },
|
totleItem(item.value)
|
||||||
{ title: 'Photo', number: item?.value?.photo_count },
|
) : (
|
||||||
{ title: 'Length', number: formatDuration(item?.value?.video_length || 0) }
|
<View style={{ flex: 1 }}>
|
||||||
],
|
{CategoryComponent({
|
||||||
bgSvg: item?.value?.cover_url,
|
title: item?.key,
|
||||||
})
|
data: [
|
||||||
|
{ title: 'Video', number: item?.value?.video_count },
|
||||||
|
{ title: 'Photo', number: item?.value?.photo_count },
|
||||||
|
{ title: 'Length', number: formatDuration(item?.value?.video_length || 0) }
|
||||||
|
],
|
||||||
|
bgSvg: item?.value?.cover_url,
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -97,7 +107,7 @@ const styles = StyleSheet.create({
|
|||||||
container: {
|
container: {
|
||||||
backgroundColor: "#FFB645",
|
backgroundColor: "#FFB645",
|
||||||
padding: 16,
|
padding: 16,
|
||||||
borderRadius: 20,
|
borderRadius: 16,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user