import { ObservableKeyboard } from '@ulangi/ulangi-observable' ; import { Keyboard } from 'react-native' ; export function autoUpdateKeyboardState ( observableKeyboard ) { const showingSubscription = Keyboard . addListener ( 'keyboardDidShow' , ( ) : void => { observableKeyboard . state = 'showing' ; } ) ; const hiddenSubscription = Keyboard . addListener ( 'keyboardDidHide' , ( ) : void => { observableKeyboard . state = 'hidden' ; } ) ; return ( ) : void => { showingSubscription . remove ( ) ; hiddenSubscription . remove ( ) ; } ; }