Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native TextInput closes automatically when opened on android

Tags:

react-native

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?

like image 716
Cristian Avatar asked Dec 05 '25 06:12

Cristian


2 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.

like image 196
Biswanath Tewari Avatar answered Dec 07 '25 20:12

Biswanath Tewari


Change the line in AndroidManifest.xml

Old line android:windowSoftInputMode="adjustResize"

New line android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

like image 24
Bilal Yaqoob Avatar answered Dec 07 '25 22:12

Bilal Yaqoob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!