diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/custom-animations/PressableScale.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/custom-animations/PressableScale.tsx b/src/lib/custom-animations/PressableScale.tsx index ca080dc8a..4737b9ea3 100644 --- a/src/lib/custom-animations/PressableScale.tsx +++ b/src/lib/custom-animations/PressableScale.tsx @@ -4,6 +4,7 @@ import Animated, { cancelAnimation, runOnJS, useAnimatedStyle, + useReducedMotion, useSharedValue, withTiming, } from 'react-native-reanimated' @@ -26,6 +27,8 @@ export function PressableScale({ targetScale?: number style?: StyleProp<ViewStyle> } & Exclude<PressableProps, 'onPressIn' | 'onPressOut' | 'style'>) { + const reducedMotion = useReducedMotion() + const scale = useSharedValue(1) const animatedStyle = useAnimatedStyle(() => ({ @@ -51,7 +54,7 @@ export function PressableScale({ cancelAnimation(scale) scale.value = withTiming(1, {duration: 100}) }} - style={[animatedStyle, style]} + style={[!reducedMotion && animatedStyle, style]} {...rest}> {children} </AnimatedPressable> |