From 90ba67acace4fe6814698fe94a3eb8eaf384c2ef Mon Sep 17 00:00:00 2001 From: Innei Date: Thu, 27 Feb 2025 15:04:55 +0800 Subject: [PATCH] fix(mobile): optimize animation cancellation and UI styling - Add `cancelAnimation` to prevent animation conflicts in SubmitButton and Tabbar - Adjust Tabbar animation duration for smoother transitions - Update email login background color to use secondary system background Signed-off-by: Innei --- apps/mobile/src/components/common/SubmitButton.tsx | 2 ++ apps/mobile/src/components/layouts/tabbar/Tabbar.tsx | 3 ++- apps/mobile/src/modules/login/email.tsx | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/mobile/src/components/common/SubmitButton.tsx b/apps/mobile/src/components/common/SubmitButton.tsx index 0e1c5b3c9..fd048e333 100644 --- a/apps/mobile/src/components/common/SubmitButton.tsx +++ b/apps/mobile/src/components/common/SubmitButton.tsx @@ -3,6 +3,7 @@ import { useEffect } from "react" import type { PressableProps } from "react-native" import { ActivityIndicator } from "react-native" import Animated, { + cancelAnimation, interpolateColor, useAnimatedStyle, useSharedValue, @@ -25,6 +26,7 @@ export function SubmitButton({ const disabledValue = useSharedValue(1) useEffect(() => { + cancelAnimation(disabledValue) disabledValue.value = withTiming(props.disabled ? 1 : 0) }, [props.disabled]) diff --git a/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx b/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx index 1b4ff408b..5e1f1f38c 100644 --- a/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx +++ b/apps/mobile/src/components/layouts/tabbar/Tabbar.tsx @@ -163,7 +163,8 @@ const TextLabel = (props: { color: interpolateColor(focusedValue.value, [0, 1], [inactiveTintColor, accentColor]), })) useEffect(() => { - focusedValue.value = withSpring(focused ? 1 : 0) + cancelAnimation(focusedValue) + focusedValue.value = withSpring(focused ? 1 : 0, { duration: 100 }) }, [focused, focusedValue]) return ( - +