feat: 轮播图大小

This commit is contained in:
jinyaqiu 2025-07-21 19:59:59 +08:00
parent 80eaad039e
commit 9d1c4c9744

View File

@ -1,6 +1,6 @@
import { Counter, UserCountData } from "@/types/user";
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 Carousel, {
ICarouselInstance
@ -72,21 +72,31 @@ function CarouselComponent(props: Props) {
mode="parallax"
onProgressChange={progress}
defaultIndex={carouselDataValue?.findIndex((item) => item?.key === 'total_count') - 1 || 0}
renderItem={({ item }) => {
if (item?.key === 'total_count') {
return totleItem(item.value)
}
return CategoryComponent(
{
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,
})
renderItem={({ item, index }) => {
const style: ViewStyle = {
marginHorizontal: 10,
width: '92%',
height: '92%',
};
return (
<View key={index} style={style}>
{item?.key === 'total_count' ? (
totleItem(item.value)
) : (
<View style={{ flex: 1 }}>
{CategoryComponent({
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>
@ -97,7 +107,7 @@ const styles = StyleSheet.create({
container: {
backgroundColor: "#FFB645",
padding: 16,
borderRadius: 20,
borderRadius: 16,
display: "flex",
flexDirection: "column",
justifyContent: "space-between",