react-native-easy-toast
react-native-easy-toast copied to clipboard
Keyboard open
When keyboard is open the toast is behind the keyboard. it should be over the keyboard
同问
I also want to know how to solve it.
any fixes?
here: add setKeyboardHeight function in index.js
setKeyboardHeight(h) {
this.keyboardHeight = h
}
in render()
case 'bottom':
pos = height - this.props.positionValue - this.keyboardHeight
handle keyboard show/hide in your component
componentDidMount() {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow)
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide)
}
componentWillUnmount() {
this.keyboardDidShowListener.remove()
this.keyboardDidHideListener.remove()
}
_keyboardDidShow (e) {
this.toast.setKeyboardHeight(e.endCoordinates.height)
}
_keyboardDidHide () {
this.toast.setKeyboardHeight(0)
}
this.toast = ref
<Toast ref={(ref) => { this.toast = ref }} />
hope helps!
any fixes?
Depending on your usecase, you could wrap the screen in KeyboardAvoidingView
Any correction? I'm using KeyboardAvoidingView along with ScrollView and the message does not appear over the keyboard.