@devrue/rn-select
Version:
Custom typescript only select component for react native
23 lines • 705 B
JavaScript
import { useRef } from 'react';
import { Animated } from 'react-native';
export default function useAnimations(strategy = 'fade') {
const value = useRef(new Animated.Value(0));
switch (strategy) {
case 'spring':
return [value.current, (_, type = 'in') => {
Animated.spring(value.current, {
toValue: type === 'in' ? 1 : 0,
useNativeDriver: true
}).start();
}];
default:
return [value.current, (duration = 1000, type = 'in') => {
Animated.timing(value.current, {
toValue: type === 'in' ? 1 : 0,
duration,
useNativeDriver: true
}).start();
}];
}
}
//# sourceMappingURL=useAnimation.js.map