import { useRef } from 'react'; import { Animated, StyleSheet, TouchableOpacity, TouchableOpacityProps, } from 'react-native'; const AnimatedTouchable = Animated.createAnimatedComponent(TouchableOpacity); function Touchable({ children, onPress, style, ...props }: TouchableOpacityProps) { const scale = useRef(new Animated.Value(1)).current; const styles = StyleSheet.flatten([style]); const onPressIn = () => { Animated.spring(scale, { toValue: 0.95, useNativeDriver: true, }).start(); }; const onPressOut = () => { Animated.spring(scale, { toValue: 1, useNativeDriver: true, }).start(); }; return ( {children} ); } export default Touchable;