From 9176a8ff64e776a0c5a89e5f13db03f212c05722 Mon Sep 17 00:00:00 2001
From: Hailey <me@haileyok.com>
Date: Thu, 10 Oct 2024 19:21:04 -0700
Subject: dont scale in pressable w/ reduced motion (#5697)

---
 src/lib/custom-animations/PressableScale.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/lib/custom-animations/PressableScale.tsx')

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>
-- 
cgit 1.4.1

