Skip to content

Commit 94cf11e

Browse files
committed
fix: fixed keyboard dismissing issue with Reanimated v3 (#1346)(by @janicduplessis)
* Fix reanimated freezing Keyboard module
1 parent 9c5af58 commit 94cf11e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

example/app/src/screens/advanced/customGestureHandling/useCustomGestureEventsHandlers.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
} from '@gorhom/bottom-sheet';
1313
import { useGestureTranslationY } from './GestureTranslationContext';
1414

15+
const dismissKeyboardOnJs = runOnJS(Keyboard.dismiss);
16+
1517
export const useCustomGestureEventsHandlers = () => {
1618
// hooks
1719
const gestureTranslationY = useGestureTranslationY();
@@ -266,7 +268,7 @@ export const useCustomGestureEventsHandlers = () => {
266268
absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value
267269
)
268270
) {
269-
runOnJS(Keyboard.dismiss)();
271+
dismissKeyboardOnJs();
270272
}
271273
}
272274

src/hooks/useGestureEventsHandlersDefault.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ type GestureEventContextType = {
2121
isScrollablePositionLocked: boolean;
2222
};
2323

24+
const dismissKeyboardOnJs = runOnJS(Keyboard.dismiss);
25+
2426
export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =
2527
() => {
2628
//#region variables
@@ -296,7 +298,7 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =
296298
absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value
297299
)
298300
) {
299-
runOnJS(Keyboard.dismiss)();
301+
dismissKeyboardOnJs();
300302
}
301303
}
302304

0 commit comments

Comments
 (0)