mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
27 lines
612 B
TypeScript
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;
|