about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-10-10 19:21:04 -0700
committerGitHub <noreply@github.com>2024-10-10 19:21:04 -0700
commit9176a8ff64e776a0c5a89e5f13db03f212c05722 (patch)
tree3e795c5936bdc559bb894cc639b358ee620beca0 /src
parent32bf38940de5a179ca1b659eaa557f93cadc9458 (diff)
downloadvoidsky-9176a8ff64e776a0c5a89e5f13db03f212c05722.tar.zst
dont scale in pressable w/ reduced motion (#5697)
Diffstat (limited to 'src')
-rw-r--r--src/lib/custom-animations/PressableScale.tsx5
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>