Setting failOffsetY through panViewRef.current.setNativeProps causes activeOffsetX to not work
See original GitHub issueDescription
Setting failOffsetY through panViewRef.current.setNativeProps causes activeOffsetX to not work
Im trying to activate the panGestureHandler only when the scroll offset of my flat list is at 0, The logic i’m using works fine except one thing. As the comments in the code show, when setting failOffsetY: [-0.1, 0.1] it renders activeOffsetX: [-999, 0.1] useless and my x axis does not get activated. Are we not allowed to put these parameters together? I’m having a hard time finding where the issue is arising from.
Steps To Reproduce
Please look at the snack provided: https://snack.expo.dev/@haibert/activeoffsety
Expected behavior
I want to be able to assigning the failOffsetY of the Y axis to [-0.1, 0.1] while also assigning the activeOffsetX of the X axis to [-999, 0.1]
Actual behavior
failOffsetY gets assigned but activeOffsetX does not get assigned. ONLY when I comment out failOffsetY: [-0.1, 0.1] , activeOffsetX: [-999, 0.1] gets assigned.
Snack or minimal code example
https://snack.expo.dev/@haibert/activeoffsety
const toggleGestureActivation = useCallback((shouldLock = false) => {
panViewRef.current.setNativeProps({
...(shouldLock
? {
activeOffsetY: [-999, 0.1],
failOffsetY: [-0.1, 999],
//this doesn't run
activeOffsetX: [-999, 0.1],
}
: {
activeOffsetY: [-100, 100],
failOffsetY: [-0.1, 0.1],
//this doesn't run
activeOffsetX: [-999, 0.1],
}),
})
}, [])
Package versions
- React: 16.13.1
- React Native: 0.63
- React Native Gesture Handler: ~1.10.2
- Expo : 42
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Yes, I that was on Android, I tried the iOS and I it looks like it’s working:
https://user-images.githubusercontent.com/21055725/164483065-32365f2f-6a97-4568-843d-00efcdc276f7.mp4
I needed to uncomment the props on
PanGestureHandler
and changedfailOffsetY: [-0.1, 0.1]
tofailOffsetY: [-20, 20]
in the callback. Also, it seems likescrollEventThrottle={0}
results in different behavior on iOS, so I had to set it to1
.If I understand correctly, it’s working as intended on both platforms so I’ll close the issue. If that’s not the case, feel free to reopen it.