react-native-gesture-handler
react-native-gesture-handler copied to clipboard
Complete `Pressable` refactor.
Description
This PR introduces a complete Pressable refactor.
New Pressable version defines sequences of events required to activate different Pressable callbacks.
This approach allows for fewer edge-case controls, and features a much cleaner code base & a clear execution flow.
The new implementation also makes detection and handling of new, unexpected cases much simpler.
Fixes
- Fixes #3476
- [
iOS] Short taps were ignored when within a list - Ordering of
onPress*was chaotic. Aligned it to the documentation.
Completion checklist
onPress*- [x] callbacks
- [x] support
hitSlop - [x] support
unstable_pressDelay
onHover*callbacks- [x] callback
- [x] support
delayHoverIn,delayHoverOut
onLongPresssupport- [x] callback
- [x] support
delayLongPress
- [x] ref passthrough support
Androidsupport- [x] on
fabric - [x] on
paper
- [x] on
iOSsupport- Note: There's a
200msdelay beforeonPressInwhen long-pressing in a scroll list. This is an intentional "feature" withiniOS, but RNPressablemanages to avoid it. - [x] on
fabric - [x] on
paper
- Note: There's a
- [x]
Websupport MacOSsupport- [ ] on
fabric - [x] on
paper
- [ ] on
- [x]
style&childrensupport
Test plan
Use all the existing Pressable examples to test the behaviour of the newly added pressable.
Make sure to test on the following platforms:
AndroidfabricAndroidpaperiOSfabriciOSpaperMacOSfabricMacOSpaperWeb
Make sure to also test the following scenarios:
Pressableis not nested, and is not within aScrollViewPressableis nested within anotherPressable, without aScrollViewPressableis nested within anotherPressable, which is nested within a RNGHScrollViewPressableis nested within anotherPressable, which is nested within a RNScrollViewPressableis nested within anotherPressable, which is nested within aFlashListPressablewithunstable_pressDelay,delayLongPress,hitSlop&pressRetentionOffsetprops.