-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix state manager on unregistered gestures #3913
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
Changes from 3 commits
796f48a
27b2aa0
f3c1e93
8a4ffc9
2ef7381
1e11614
744b4a6
8775c6f
f3b3c26
a26a36f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ package com.swmansion.gesturehandler.react | |
|
|
||
| import android.content.Context | ||
| import android.view.View | ||
| import android.view.ViewParent | ||
| import com.facebook.react.bridge.ReadableArray | ||
| import com.facebook.react.uimanager.ThemedReactContext | ||
| import com.facebook.react.uimanager.UIManagerHelper | ||
|
|
@@ -202,7 +203,23 @@ class RNGestureHandlerDetectorView(context: Context) : ReactViewGroup(context) { | |
| child.value.clear() | ||
| } | ||
| } | ||
| fun recordHandlerIfNotPresent(handler: GestureHandler) { | ||
| findGestureHandlerRootView()?.recordHandlerIfNotPresent(handler) | ||
| } | ||
|
|
||
| private fun findGestureHandlerRootView(): RNGestureHandlerRootView? { | ||
| var parent: ViewParent? = this.parent | ||
| var gestureHandlerRootView: RNGestureHandlerRootView? = null | ||
|
|
||
| while (parent != null) { | ||
| if (parent is RNGestureHandlerRootView) { | ||
| gestureHandlerRootView = parent | ||
| } | ||
| parent = parent.parent | ||
| } | ||
|
|
||
| return gestureHandlerRootView | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we have this exact method already defined somewhere? Maybe it's worth moving it to some utils, or making it an extension on View?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I moved it to be companion object for the rootView in 8a4ffc9. Let me know what you think.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I'm not sure whether |
||
| private fun ReadableArray.mapVirtualChildren(): List<VirtualChildren> = List(size()) { i -> | ||
| val child = getMap(i) ?: return@List null | ||
| val handlerTags = child.getArray("handlerTags")?.toIntList().orEmpty() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.