react-native: Keyboard events not working on Android
RN 0.36, Samsung Galaxy S6 running Android 6.0.1.
componentDidMount() {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
}
Logging in those methods, I can see that they are called on iOS, but not Android. I’ve read all the other issue threads regarding this but most of them are old at this point. I’ve added android:windowSoftInputMode="adjustResize"
to my manifest. What am I missing?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (4 by maintainers)
i still cannot get the event working on RN42,
Still an issue with react-native 0.50.0, is this being worked on? Can this be reopened?
@jonas-arkulpa I’m also trying to get https://github.com/wix/react-native-keyboard-aware-scrollview to work on Android. I’m noticing another difference between the behavior of iOS and Android.
It looks like ‘keyboardDidShow’ fires every time when entering a TextField on iOS even if the keyboard is up. In Android it only fires once, that is if the keyboard is already up it doesn’t fire when entering a TextField. The Android behavior seems more correct but unfortunately I actually want the iOS behavior. It would be great if the behavior was consistent.
Tried this on a new 0.36 project and it works as expected:
I’m not sure what is needed to make it work – if you have a lot of custom Android code it might be worth creating a new project, copying the android directory in and overwriting everything and then painfully stepping over the diff to see what is missing. Let us know what you find!