Commit 4b51523
Fix interactions with NativeViewGestureHandler (software-mansion#1034)
### Context
[`transformIntoHandlerTags`](https://github.com/software-mansion/react-native-gesture-handler/blob/master/createHandler.js#L91) creates an array of valid refs based on the value of the property `_handlerTag` of each ref passed to `waitFor` or `simultaneousHandlers` prop. The filtered array is then sent to native for configuration.
### `NativeViewGestureHandler`
In the case of `NativeViewGestureHandler` the `_handlerTag` is set on the `NativeViewGestureHandler` ref properly.
**HOWEVER**, this value isn't passed to the ref of it's child. The child's ref is the one being passed back as the ref handler of the component. This makes sense.
**However**, in order to configure interactions on a different handler one would need to pass the `NativeViewGestureHandler` ref as part of `waitFor` or `simultaneousHandlers` prop.
This is **IMPOSSIBLE** because the `NativeViewGestureHandler` ref isn't exposed.
The child's ref is passed instead and is filtered out by `transformIntoHandlerTags` due to the lack of `_handlerTag` property, making it completely useless.
### The End
This PR fixes the mentioned problem by setting the `_handlerTag` property on the `NativeViewGestureHandler` **child's ref** so when it is passed to `waitFor` or `simultaneousHandlers` it is treated as if it were a genuine gesture handler.
Co-authored-by: Jakub <[email protected]>1 parent 84ab2e8 commit 4b51523
1 file changed
+14
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
45 | 56 | | |
46 | | - | |
47 | | - | |
| 57 | + | |
| 58 | + | |
48 | 59 | | |
49 | 60 | | |
50 | 61 | | |
| |||
0 commit comments