feat: 新增动画资源与庆祝效果,优化布局与标签页配置

This commit is contained in:
richarjiang
2025-09-03 15:03:26 +08:00
parent 8b6ef378d0
commit 951c02f644
14 changed files with 373 additions and 267 deletions

View File

@@ -0,0 +1,62 @@
import LottieView from 'lottie-react-native';
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
import {
Dimensions,
StyleSheet,
View,
} from 'react-native';
export interface CelebrationAnimationRef {
play: () => void;
}
interface CelebrationAnimationProps {
visible?: boolean;
}
const CelebrationAnimation = forwardRef<CelebrationAnimationRef, CelebrationAnimationProps>(
({ visible = true }, ref) => {
const animationRef = useRef<LottieView>(null);
useImperativeHandle(ref, () => ({
play: () => {
animationRef.current?.play();
},
}));
if (!visible) return null;
return (
<View style={styles.container} pointerEvents="none">
<LottieView
ref={animationRef}
autoPlay={false}
loop={false}
source={require('@/assets/lottie/Confetti.json')}
style={styles.animation}
/>
</View>
);
}
);
const styles = StyleSheet.create({
container: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: 9999,
alignItems: 'center',
justifyContent: 'center',
},
animation: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
});
CelebrationAnimation.displayName = 'CelebrationAnimation';
export default CelebrationAnimation;