Fix Native gesture outside cancellation default#4239
Draft
sorinc03 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates NativeViewGestureHandler’s default cancel-outside behavior by removing an explicit initializer assignment and flipping the default constant.
Changes:
- Removed the
initblock that forcedshouldCancelWhenOutside = true. - Changed
DEFAULT_SHOULD_CANCEL_WHEN_OUTSIDEfromtruetofalse.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
43
to
48
|
|
||
| private var lastActiveUpdate: ActiveUpdateSnapshot? = null | ||
|
|
||
| init { | ||
| shouldCancelWhenOutside = true | ||
| } | ||
|
|
||
| override fun resetConfig() { | ||
| super.resetConfig() | ||
| shouldActivateOnStart = DEFAULT_SHOULD_ACTIVATE_ON_START |
Comment on lines
+225
to
227
| private const val DEFAULT_SHOULD_CANCEL_WHEN_OUTSIDE = false | ||
| private const val DEFAULT_SHOULD_ACTIVATE_ON_START = false | ||
| private const val DEFAULT_DISALLOW_INTERRUPTION = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4236.
NativeViewGestureHandleron Android currently overrides the base handler default and setsshouldCancelWhenOutsidetotrue. That causesGesture.Native()wrappers around scrollable native views to fail once a swipe leaves the view bounds, even though the gesture is already active.This PR restores the default to
false, matching the documented base behavior for handlers other than Tap and LongPress, while preserving the explicitshouldCancelWhenOutsideconfig path for callers that opt in.Changes
shouldCancelWhenOutside = true.NativeViewGestureHandler's Android defaultshouldCancelWhenOutsidevalue tofalse.Validation
yarn workspace react-native-gesture-handler format:androidyarn workspace react-native-gesture-handler lint:androidyarn workspace react-native-gesture-handler ts-checkyarn workspace react-native-gesture-handler test --runInBandgit diff --checkThe local pre-commit hook also ran formatting, but then failed in
apps/common-appon unrelated TypeScript setup issues (react-native-pager-viewmissing in a legacy sample). The targeted package checks above passed.I did not run the Android Snack/device reproduction locally in this pass.