I have
android:windowSoftInputMode="adjustNothing"
set in AndroidManifest.xml
Added listener to Keyboard:
componentDidMount()
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
}
Defined the function:
_keyboardDidShow = () => {
console.log('_keyboardDidShow called');
}
But _keyboardDidShow is never called when android:windowSoftInputMode="adjustNothing".
It works fine when android:windowSoftInputMode="adjustResize" or android:windowSoftInputMode="adjustPan"
From the docs:
Note that if you set android:windowSoftInputMode to adjustResize or adjustNothing, only keyboardDidShow and keyboardDidHide events will be available on Android. keyboardWillShow as well as keyboardWillHide are generally not available on Android since there is no native corresponding event.
I have looked at:
https://github.com/facebook/react-native/issues/2852 (looks like an open bug)
React Native keyboard events not working with android:windowSoftInputMode="adjustNothing" (solution: set windowSoftInputMode to adjustPan)
I can not have android:windowSoftInputMode set anything other than adjustNothing
Anybody have a solution or workaround to this issue?
.
.
.
Update January 2020: Documentation has been updated to
Note that if you set android:windowSoftInputMode to adjustResize, only keyboardDidShow and keyboardDidHide events will be available on Android. If you set android:windowSoftInputMode to adjustNothing, no events will be available on Android. keyboardWillShow as well as keyboardWillHide are generally not available on Android since there is no native corresponding event.