Skip to content

Commit 1d1a464

Browse files
janicduplessisgorhom
authored andcommitted
fix: fixed keyboard dismissing issue with Reanimated v3 (#1346)(by @janicduplessis)
1 parent 57f8067 commit 1d1a464

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/hooks/useGestureEventsHandlersDefault.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const INITIAL_CONTEXT: GestureEventContextType = {
3131
isScrollablePositionLocked: false,
3232
};
3333

34+
const dismissKeyboardOnJs = runOnJS(Keyboard.dismiss);
35+
3436
const resetContext = (context: any) => {
3537
'worklet';
3638
Object.keys(context).map(key => {
@@ -318,7 +320,7 @@ export const useGestureEventsHandlersDefault: GestureEventsHandlersHookType =
318320
absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value
319321
)
320322
) {
321-
runOnJS(Keyboard.dismiss)();
323+
dismissKeyboardOnJs();
322324
}
323325
}
324326

src/hooks/useGestureEventsHandlersDefault.web.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const INITIAL_CONTEXT: GestureEventContextType = {
3030
isScrollablePositionLocked: false,
3131
};
3232

33+
const dismissKeyboardOnJs = runOnJS(Keyboard.dismiss);
34+
3335
const resetContext = (context: any) => {
3436
'worklet';
3537
Object.keys(context).map(key => {
@@ -312,7 +314,7 @@ export const useGestureEventsHandlersDefault = () => {
312314
absoluteY > WINDOW_HEIGHT - animatedKeyboardHeight.value
313315
)
314316
) {
315-
runOnJS(Keyboard.dismiss)();
317+
dismissKeyboardOnJs();
316318
}
317319
}
318320

0 commit comments

Comments
 (0)