-
-
Notifications
You must be signed in to change notification settings - Fork 917
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug
The app crashes when dismissing keyboard. I'm getting the error below

Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 4.6.6 |
| react-native | 0.71.6 |
| react-native-reanimated | 3.0.2 |
| react-native-gesture-handler | 2.9.0 |
Steps To Reproduce
- Create a bottom sheet with BottomSheetTextInput
- Swipe down the bottom sheet
Describe what you expected to happen:
- Bottom sheet to dismiss keyboard with no crash...
Reproducible sample code
https://snack.expo.dev/UXATlw3L7
Here is the diff that solved my problem:
diff --git a/node_modules/@gorhom/bottom-sheet/src/hooks/useGestureEventsHandlersDefault.tsx b/node_modules/@gorhom/bottom-sheet/src/hooks/useGestureEventsHandlersDefault.tsx
index a0b759c..73eb034 100644
--- a/node_modules/@gorhom/bottom-sheet/src/hooks/useGestureEventsHandlersDefault.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/hooks/useGestureEventsHandlersDefault.tsx
@@ -21,7 +21,9 @@ type GestureEventContextType = {
isScrollablePositionLocked: boolean;
};
-const dismissKeyboardOnJs = runOnJS(Keyboard.dismiss);
+const dismissKeyboard = () => {
+ Keyboard.dismiss()
+}
export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =
() => {
@@ -298,7 +300,7 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =
absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value
)
) {
- dismissKeyboardOnJs();
+ runOnJS(dismissKeyboard)();
}
}
elliottkember, iliapnmrv, LegoGAME, lachenmayer, ErionTp and 4 moreiliapnmrv
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working