BlueWallet/hooks/useBounceAnimation.ts
Marcos Rodriguez Velez e7b41786bd
wip
2024-07-25 18:41:01 -04:00

27 lines
612 B
TypeScript

import { useEffect, useRef } from 'react';
import { Animated } from 'react-native';
const useBounceAnimation = (query: string) => {
const bounceAnim = useRef(new Animated.Value(1.0)).current;
useEffect(() => {
if (query) {
Animated.timing(bounceAnim, {
toValue: 1.2,
duration: 150,
useNativeDriver: true,
}).start(() => {
Animated.timing(bounceAnim, {
toValue: 1.0,
duration: 150,
useNativeDriver: true,
}).start();
});
}
}, [bounceAnim, query]);
return bounceAnim;
};
export default useBounceAnimation;