Skip to content

Commit 66f340a

Browse files
committed
fix: react-native-gesture-handler compatibility
1 parent 3ad36d3 commit 66f340a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ Blur tint that is mapped into native values in iOS.
214214
215215
## Troubleshooting
216216
217+
### Using `react-native-gesture-handler` on **Android**
218+
219+
On Android, RNGH does not work by default because modals are not located under React Native Root view in native hierarchy. To fix that, components need to be wrapped with `GestureHandlerRootView`.
220+
221+
Example:
222+
```ts
223+
import { GestureHandlerRootView } from 'react-native-gesture-handler'
224+
```
225+
```ts
226+
return (
227+
<TrueSheet ref={sheet}>
228+
<GestureHandlerRootView>
229+
<MyComponent />
230+
</GestureHandlerRootView>
231+
</TrueSheet>
232+
)
233+
```
234+
217235
### Integrating `@react-navigation/native` on iOS
218236
219237
On iOS, navigating to a [React Navigation](https://reactnavigation.org) screen from within the Sheet can cause issues. To resolve this, dismiss the sheet before navigating!

android/src/main/java/com/lodev09/truesheet/core/RootViewGroup.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ class RootViewGroup(context: Context?) :
115115
return super.onHoverEvent(event)
116116
}
117117

118+
@Deprecated("Deprecated in Java")
119+
override fun onChildStartedNativeGesture(ev: MotionEvent?) {
120+
mJSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher)
121+
}
122+
118123
override fun onChildStartedNativeGesture(childView: View, ev: MotionEvent) {
119124
mJSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher)
120125
mJSPointerDispatcher?.onChildStartedNativeGesture(childView, ev, eventDispatcher)

0 commit comments

Comments
 (0)