mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-24 04:04:40 +08:00
Refactor button animation logic to focus only on isFocused state and update version to 1.1.0
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { useRef, useEffect } from 'react';
|
||||
import { Animated } from 'react-native';
|
||||
|
||||
export const useButtonAnimation = (isSelected: boolean, isFocused: boolean) => {
|
||||
export const useButtonAnimation = (isFocused: boolean) => {
|
||||
const scaleValue = useRef(new Animated.Value(1)).current;
|
||||
|
||||
useEffect(() => {
|
||||
Animated.spring(scaleValue, {
|
||||
toValue: isSelected || isFocused ? 1.1 : 1,
|
||||
toValue: isFocused ? 1.1 : 1,
|
||||
friction: 5,
|
||||
useNativeDriver: true,
|
||||
}).start();
|
||||
}, [isSelected, isFocused, scaleValue]);
|
||||
}, [ isFocused, scaleValue]);
|
||||
|
||||
return {
|
||||
transform: [{ scale: scaleValue }],
|
||||
|
||||
Reference in New Issue
Block a user