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 <tukon479@gmail.com>
This commit is contained in:
Innei
2025-02-27 15:04:55 +08:00
parent 001a4b08aa
commit 90ba67acac
3 changed files with 5 additions and 2 deletions
@@ -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])
@@ -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 (
<Animated.Text
+1 -1
View File
@@ -81,7 +81,7 @@ export function EmailLogin() {
return (
<View className="mx-auto flex w-full max-w-sm gap-6">
<View className="bg-system-grouped-background gap-4 rounded-2xl px-6 py-4">
<View className="bg-secondary-system-background gap-4 rounded-2xl px-6 py-4">
<View className="flex-row">
<Input
autoCapitalize="none"