-
-
Notifications
You must be signed in to change notification settings - Fork 982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Fix gestures being able to activate despite their parent already being active #3095
[Android] Fix gestures being able to activate despite their parent already being active #3095
Conversation
android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
Outdated
Show resolved
Hide resolved
…y-from-native-gesture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! 🚀
Please have a look at the comments below 😅
private fun isActive(state: Int) = | ||
state == GestureHandler.STATE_ACTIVE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is used anywhere 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed ef986a0
private fun shouldBeCancelledByFinishedHandler(handler: GestureHandler<*>) = | ||
gestureHandlers.any { shouldHandlerWaitForOther(handler, it) && it.state == GestureHandler.STATE_END } | ||
|
||
private fun handlersWithinHandlerBounds(handler: GestureHandler<*>) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is quite misleading. For me it suggests that we compare positions of native views, while in reality we check for common pointers.
What about handlersWithCommonPointers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function was removed in 6d11f86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, please wait for @j-piasecki approval 🟢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This PR fixes invalid activation of gestures nested inside other gestures, like
Pan
gesture nested insideNative
gesture attached toScrollView
Gestures nested inside native elements such as
ScrollView
used to be able to steal pointers from their already active parents.That is no longer possible, already active parents cannot have their active pointers stolen.
Related to #2622
Test plan
EmptyExample.tsx
ScrollView
ScrollView
, drag thePan
gesturePan
gesture activated, and with this PR it doesn't anymoreNotes
Gesture.Simultaneous()
orsimultaneousWithExternalGesture()
Code
Collapsed code