React Native TextInput closes automatically when opened on android

Viewed 4033

I switched laptops and cloned the repository of my project, did a quick yarn install and looks like it was a big difference from the one on the main branch but I didn't bother since maybe it's just because of different Node versions.

Now every time I click on one TextInput the keyboard opens and closes immediately only on android. I attached a quick recording here. Tried some solutions and it looks like switching android:windowSoftInputMode from adjustResize to adjustPan in AndroidManifest.xml fixes the problem with the closing but I'm not really happy with the behaviour of the keyboard in the app when it's set to adjustPan. Maybe this issue starting happening a while ago but I just saw it now.

Here is just an input centered inside a simple View. https://gfycat.com/ordinaryquestionabledinosaur

Any suggestions anyone?

7 Answers

Was facing a similar issue, turned out that the react-native-screens library was causing the problem. Try setting the version to "~3.10.2". Worked out for me.

Change the line in AndroidManifest.xml

Old line android:windowSoftInputMode="adjustResize"

New line android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

Change the line in AndroidManifest.xml works for me, I did the update but that does not works

Change the config to:

android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

Just Upgraded react-native-screen to latest version.

yarn add react-native-screens

"react-native-screens": "^3.13.1"

For those who have the same problem, having both botton and top padding often result on the keyboard closing itself when opening. Took a while to discover that

if you're using react native version "0.64.*". Just set react-native-screens version to "3.4.0". Do not use "^" to avoid npm updated it. and it worked for me.

Change the line in the AndroidManifest.xml file:

Before

 android:windowSoftInputMode="adjustResize"

After

 android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
Related