11import React , { createContext , ReactElement , useContext , useState } from 'react' ;
2+ import { Platform } from 'react-native' ;
23import { useKeyboardHandler } from 'react-native-keyboard-controller' ;
34import { runOnJS , SharedValue , useAnimatedReaction , useSharedValue } from 'react-native-reanimated' ;
45import { useSafeAreaInsets } from 'react-native-safe-area-context' ;
@@ -77,8 +78,9 @@ export const useEmojiKeyboard = () => {
7778
7879 const { bottom } = useSafeAreaInsets ( ) ;
7980 const { height } = useKeyboardAnimation ( ) ;
80- const keyboardHeight = useSharedValue ( bottom ) ;
81- const previousHeight = useSharedValue ( bottom ) ;
81+ const initialHeight = Platform . OS === 'ios' ? bottom : 0 ;
82+ const keyboardHeight = useSharedValue ( initialHeight ) ;
83+ const previousHeight = useSharedValue ( initialHeight ) ;
8284
8385 const updateHeight = ( force : boolean = false ) => {
8486 'worklet' ;
@@ -90,7 +92,9 @@ export const useEmojiKeyboard = () => {
9092 ) {
9193 return ;
9294 }
93- const notch = height . value > 0 ? 0 : bottom ;
95+ // On iOS, keyboard controller doesn't include bottom inset, so we add it when keyboard is closed
96+ // On Android, keyboard controller already includes it, so we don't add it
97+ const notch = Platform . OS === 'ios' && height . value === 0 ? bottom : 0 ;
9498 keyboardHeight . value = height . value + notch ;
9599 previousHeight . value = keyboardHeight . value ;
96100 } ;
0 commit comments