-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Virtual detector native gestures #3765
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 6 commits
e68928d
5fdc74a
b8d999f
359402e
02f8732
7d591f4
d1eaf3c
91ea2e7
3c2ddac
9eb434f
8c42422
66e7f23
ed852b6
3cf56a6
6dffddb
c06d53e
6f2ab21
f355293
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
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. I'm curious, why did the order of attach/detach change?
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. If you follow the logic in
Contributor
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. I'm not sure what is
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. I meant
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. I could not replicate the same issue on web due to how views are reused there, but I decided to add a similar fix to be safe. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,36 +14,38 @@ export function LogicDetector<THandlerData, TConfig>( | |||||
| const [viewTag, setViewTag] = useState<number>(-1); | ||||||
| const logicMethods = useRef(props.gesture.detectorCallbacks); | ||||||
|
|
||||||
| const handleRef = useCallback((node: any) => { | ||||||
| viewRef.current = node; | ||||||
| if (!node) { | ||||||
| return; | ||||||
| } | ||||||
| const handleRef = useCallback( | ||||||
| (node: any) => { | ||||||
| viewRef.current = node; | ||||||
| if (!node) { | ||||||
| return; | ||||||
| } | ||||||
| let tag: number | null = null; | ||||||
| if (Platform.OS === 'web') { | ||||||
| tag = node; | ||||||
| } else { | ||||||
| tag = findNodeHandle(node); | ||||||
| } | ||||||
m-bert marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| if (Platform.OS === 'web') { | ||||||
| setViewTag(node); | ||||||
| } else { | ||||||
| const tag = findNodeHandle(node); | ||||||
| if (tag != null) { | ||||||
| console.log('register ', tag); | ||||||
m-bert marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| setViewTag(tag); | ||||||
| } | ||||||
| } | ||||||
| }, []); | ||||||
|
|
||||||
| return () => { | ||||||
| if (tag != null) { | ||||||
| console.log('unregister ', tag); | ||||||
m-bert marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| unregister(viewTag); | ||||||
|
||||||
| unregister(viewTag); | |
| unregister(tag); |
I assume this shouldn't be unregistering for the old view tag.
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.
Thanks, c06d53e.
Uh oh!
There was an error while loading. Please reload this page.