diff options
author | Elijah Seed-Arita <elijaharita@gmail.com> | 2025-07-23 15:19:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-23 15:19:48 -0700 |
commit | 6a7b8a279b6113def5d6330ef40801a5484a0b7c (patch) | |
tree | d3c9f3244a3cee451b3465605d46a0b90dda3ac0 /src/lib/custom-animations | |
parent | 3ae3ed245bad12c2222ea04a9bf13ba4589e90ad (diff) | |
download | voidsky-6a7b8a279b6113def5d6330ef40801a5484a0b7c.tar.zst |
[APP-1291] prevent GestureActionView from hijacking swipe in a direction which no actions are specified (#8705)
Co-authored-by: hailey <hailey@blueskyweb.xyz>
Diffstat (limited to 'src/lib/custom-animations')
-rw-r--r-- | src/lib/custom-animations/GestureActionView.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/custom-animations/GestureActionView.tsx b/src/lib/custom-animations/GestureActionView.tsx index ba6952a81..e7fba570b 100644 --- a/src/lib/custom-animations/GestureActionView.tsx +++ b/src/lib/custom-animations/GestureActionView.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {ColorValue, Dimensions, StyleSheet, View} from 'react-native' +import {type ColorValue, Dimensions, StyleSheet, View} from 'react-native' import {Gesture, GestureDetector} from 'react-native-gesture-handler' import Animated, { clamp, @@ -114,11 +114,16 @@ export function GestureActionView({ }, ) + // NOTE(haileyok): + // Absurdly high value so it doesn't interfere with the pan gestures above (i.e., scroll) + // reanimated doesn't offer great support for disabling y/x axes :/ + const effectivelyDisabledOffset = 200 const panGesture = Gesture.Pan() - .activeOffsetX([-10, 10]) - // Absurdly high value so it doesn't interfere with the pan gestures above (i.e., scroll) - // reanimated doesn't offer great support for disabling y/x axes :/ - .activeOffsetY([-200, 200]) + .activeOffsetX([ + actions.leftFirst ? -10 : -effectivelyDisabledOffset, + actions.rightFirst ? 10 : effectivelyDisabledOffset, + ]) + .activeOffsetY([-effectivelyDisabledOffset, effectivelyDisabledOffset]) .onStart(() => { 'worklet' isActive.set(true) |