feat: 轮播图
This commit is contained in:
parent
487f0a773d
commit
b0eb244146
@ -13,13 +13,14 @@ import { CountData, UserInfoDetails } from '@/types/user';
|
||||
import { useFocusEffect, useRouter } from 'expo-router';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FlatList, StyleSheet, View } from 'react-native';
|
||||
import { Dimensions, FlatList, StyleSheet, View } from 'react-native';
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
|
||||
export default function OwnerPage() {
|
||||
const insets = useSafeAreaInsets();
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const width = Dimensions.get("window").width;
|
||||
|
||||
// 添加页面挂载状态
|
||||
const [isMounted, setIsMounted] = useState(false);
|
||||
@ -122,7 +123,7 @@ export default function OwnerPage() {
|
||||
<MemberCard pro={userInfoDetails?.membership_level} points={userInfoDetails?.remain_points} />
|
||||
|
||||
{/* 分类 */}
|
||||
<View style={{ marginHorizontal: -16, marginBottom: -16 }}>
|
||||
<View style={{ marginHorizontal: -16, marginBottom: -width * 0.26 }}>
|
||||
<CarouselComponent data={userInfoDetails?.material_counter} />
|
||||
</View>
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ function CarouselComponent(props: Props) {
|
||||
}}>
|
||||
<Carousel
|
||||
width={width}
|
||||
height={width * 0.75}
|
||||
height={width}
|
||||
data={carouselDataValue || []}
|
||||
mode="parallax"
|
||||
onSnapToItem={(index) => setCurrentIndex(index)}
|
||||
@ -89,16 +89,14 @@ function CarouselComponent(props: Props) {
|
||||
}
|
||||
modeConfig={{
|
||||
parallaxScrollingScale: 1,
|
||||
parallaxScrollingOffset: 140,
|
||||
parallaxScrollingOffset: 130,
|
||||
parallaxAdjacentItemScale: 0.7
|
||||
}}
|
||||
renderItem={({ item, index }) => {
|
||||
const isActive = index === currentIndex;
|
||||
const style: ViewStyle = {
|
||||
width: width,
|
||||
height: width * 0.8,
|
||||
alignItems: "center",
|
||||
// paddingTop: isActive && item?.key === 'total_count' ? 0 : 40
|
||||
height: width * 0.7,
|
||||
alignItems: "center"
|
||||
};
|
||||
return (
|
||||
<View key={index} style={[style]}>
|
||||
|
||||
@ -44,7 +44,7 @@ const CategoryComponent = ({ title, data, bgSvg, style, width }: CategoryProps)
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={[styles.container, style, { width: width * 0.7 }]}>
|
||||
<View style={[styles.container, style, { width: width * 0.73 }]}>
|
||||
<View style={styles.backgroundContainer}>
|
||||
<Image
|
||||
source={bgSvg !== "" && bgSvg !== null ? { uri: bgSvg } : require('@/assets/images/png/owner/people.png')}
|
||||
@ -67,7 +67,7 @@ const CategoryComponent = ({ title, data, bgSvg, style, width }: CategoryProps)
|
||||
</View>
|
||||
<ThemedText style={styles.itemTitle}>{item.title}</ThemedText>
|
||||
</View>
|
||||
<View style={{ alignSelf: 'flex-start', flex: 1, width: 100 }}>
|
||||
<View style={{ alignSelf: 'flex-start', flex: 1 }}>
|
||||
{item?.title === "Length" ? (
|
||||
typeof item.number === 'object' ? (
|
||||
renderTimeDisplay(item.number)
|
||||
@ -110,6 +110,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
content: {
|
||||
padding: 32,
|
||||
paddingRight: 16,
|
||||
justifyContent: "space-between",
|
||||
flex: 1
|
||||
},
|
||||
@ -136,7 +137,7 @@ const styles = StyleSheet.create({
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingVertical: 8,
|
||||
paddingVertical: 16,
|
||||
width: '100%',
|
||||
},
|
||||
itemTitle: {
|
||||
@ -152,7 +153,6 @@ const styles = StyleSheet.create({
|
||||
lineHeight: 30,
|
||||
fontWeight: '700',
|
||||
textAlign: 'left',
|
||||
marginLeft: 8,
|
||||
flex: 1,
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user