UNPKG

@duocvo/react-native-select-dropdown

Version:

This package was forked from https://github.com/AdelRedaa97/react-native-select-dropdown. Allow multiple select dropdown with search and custom styles.

22 lines (18 loc) 601 B
import {useEffect, useState} from 'react'; import {Keyboard} from 'react-native'; export const useKeyboardHeight = () => { const [keyboardHeight, setKeyboardHeight] = useState(0); useEffect(() => { const showSubscription = Keyboard.addListener('keyboardDidShow', e => { setKeyboardHeight(e.endCoordinates.height); }); const hideSubscription = Keyboard.addListener('keyboardDidHide', () => { setKeyboardHeight(0); }); return () => { showSubscription.remove(); hideSubscription.remove(); }; }, [setKeyboardHeight]); return {keyboardHeight}; };