feat: 添加用户推送通知偏好设置功能,支持开启/关闭推送通知

This commit is contained in:
richarjiang
2025-09-03 10:58:45 +08:00
parent e33a690a36
commit 8b6ef378d0
6 changed files with 265 additions and 26 deletions

View File

@@ -54,21 +54,29 @@ const StepsCard: React.FC<StepsCardProps> = ({
// 触发柱体动画
useEffect(() => {
if (chartData && chartData.length > 0) {
// 检查是否有实际数据(不只是空数组)
const hasData = chartData && chartData.length > 0 && chartData.some(data => data.steps > 0);
if (hasData) {
// 重置所有动画值
animatedValues.forEach(animValue => animValue.setValue(0));
// 同时启动所有柱体的弹性动画,有步数的柱体才执行动画
chartData.forEach((data, index) => {
if (data.steps > 0) {
Animated.spring(animatedValues[index], {
toValue: 1,
tension: 150,
friction: 8,
useNativeDriver: false,
}).start();
}
});
// 使用 setTimeout 确保在下一个事件循环中执行动画,保证组件已完全渲染
const timeoutId = setTimeout(() => {
// 同时启动所有柱体的弹性动画,有步数的柱体才执行动画
chartData.forEach((data, index) => {
if (data.steps > 0) {
Animated.spring(animatedValues[index], {
toValue: 1,
tension: 150,
friction: 8,
useNativeDriver: false,
}).start();
}
});
}, 50); // 添加小延迟确保渲染完成
return () => clearTimeout(timeoutId);
}
}, [chartData, animatedValues]);