Refactor components for consistent styling and improve button animations

This commit is contained in:
zimplexing
2025-07-08 19:52:20 +08:00
parent 504f12067b
commit 74ad0872cb
7 changed files with 89 additions and 66 deletions

View File

@@ -0,0 +1,18 @@
import { useRef, useEffect } from 'react';
import { Animated } from 'react-native';
export const useButtonAnimation = (isSelected: boolean, isFocused: boolean) => {
const scaleValue = useRef(new Animated.Value(1)).current;
useEffect(() => {
Animated.spring(scaleValue, {
toValue: isSelected || isFocused ? 1.1 : 1,
friction: 5,
useNativeDriver: true,
}).start();
}, [isSelected, isFocused, scaleValue]);
return {
transform: [{ scale: scaleValue }],
};
};