[APP-1291] prevent GestureActionView from hijacking swipe in a direction which no actions are specified (#8705)
Co-authored-by: hailey <hailey@blueskyweb.xyz>
This commit is contained in:
committed by
GitHub
parent
3ae3ed245b
commit
6a7b8a279b
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react'
|
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 {Gesture, GestureDetector} from 'react-native-gesture-handler'
|
||||||
import Animated, {
|
import Animated, {
|
||||||
clamp,
|
clamp,
|
||||||
@@ -114,11 +114,16 @@ export function GestureActionView({
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const panGesture = Gesture.Pan()
|
// NOTE(haileyok):
|
||||||
.activeOffsetX([-10, 10])
|
|
||||||
// Absurdly high value so it doesn't interfere with the pan gestures above (i.e., scroll)
|
// 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 :/
|
// reanimated doesn't offer great support for disabling y/x axes :/
|
||||||
.activeOffsetY([-200, 200])
|
const effectivelyDisabledOffset = 200
|
||||||
|
const panGesture = Gesture.Pan()
|
||||||
|
.activeOffsetX([
|
||||||
|
actions.leftFirst ? -10 : -effectivelyDisabledOffset,
|
||||||
|
actions.rightFirst ? 10 : effectivelyDisabledOffset,
|
||||||
|
])
|
||||||
|
.activeOffsetY([-effectivelyDisabledOffset, effectivelyDisabledOffset])
|
||||||
.onStart(() => {
|
.onStart(() => {
|
||||||
'worklet'
|
'worklet'
|
||||||
isActive.set(true)
|
isActive.set(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user