react-native-autocomplete-dropdown
Version:
Dropdown Item picker with search and autocomplete (typeahead) functionality for react native
18 lines (14 loc) • 542 B
text/typescript
import { useEffect, useState } from 'react'
import { Keyboard } from 'react-native'
export function 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()
}
}, [])
return keyboardHeight
}