Search code examples
androidreact-nativeinputkeyboardadjustment

Keyboard adjusting issue in react native for android


I'm a beginner to react native development and for keyboard handling in my current application, I have used react-native-keyboard-manager which works well in iOS. Now for android, it says I need to set android:windowSoftInputMode to adjustResize. I've tried both adjustResize and adjustPan as well but they both behave the same way and my view get squashed up. Below are the screenshots of my view.

View before keyboard appearance

enter image description here

View after keyboard appearance

enter image description here

Am I missing something here? Is there an easy way to fix this? I'm aware of other Libraries like KeyboardAvoidingView, KeyboardSpacer and KeyboardAwareScrollView, but if I use that I would need to implement it in every view and repeat same code to do it separately for android as in iOS it already works very well. Any help is appreciated


Solution

  • If you make changes to native code in your project then you must rebuild your project.

    You will not see the updates in your simulator/emulator if you just reload it (ie pressing CMD+R or RR. This is due to the fact that when you reload all you are doing is changing the JavaScript and not the native code.

    To effect the changes (usually the best way is to remove the previous build folder first) is to run react-native run-ios or react-native run-android that way you force a rebuild and any changes to your native code are then updated on your simulator/emulator.