question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextInput closes automatically when opened on android

See original GitHub issue

Description

Hi there,

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.

Version

0.64.0

Output of npx react-native info

System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 29.16 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
    Yarn: 1.22.15 - ~/.yarn/bin/yarn
    npm: 7.19.1 - ~/.nvm/versions/node/v16.5.0/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 29, 30, 31
      Build Tools: 29.0.2, 29.0.3, 31.0.0
      System Images: android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7486908
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.0 => 0.64.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

Not really sure what could be the steps to reproduce. Maybe this issue starting happening a while ago but I just saw it now.

Snack, code example, screenshot, or link to a repository

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:13
  • Comments:29

github_iconTop GitHub Comments

25reactions
kostas2231commented, Mar 16, 2022

Unfortunately, none of the above solutions worked for me. Even I’ve tried multiple versions of react-native-screens, but no luck.

Finally, made it work the issue I had was that I upgraded to 3.10.2 and not ~3.10.2. Give it a go. Hope this helps.

21reactions
Cristi6commented, Mar 7, 2022

Hey all, asked the same thing on StackOverflow and the answer I accepted solved my issue. See if it fixes your problem too.

https://stackoverflow.com/questions/71227463/react-native-textinput-closes-automatically-when-opened-on-android

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native TextInput closes automatically when opened on ...
Now every time I click on one TextInput the keyboard opens and closes immediately only on android. I attached a quick recording here....
Read more >
Handle input method visibility | Android Developers
When input focus moves in or out of an editable text field, Android shows or hides the input method—such as the on-screen keyboard—as ......
Read more >
How to avoid the Android keyboard closing “randomly” after I ...
Simply going into the Settings and clearing both storage and cache on Gboard seems to fix the crashing issue. To do this, head...
Read more >
Today's React Native Tip: Keyboard issues in ScrollView
When you use TextInput to enter text the keyboard pops open and occupies quite a bit of space on the screen. While using...
Read more >
TextInput - React Native
Note that on Android performing text selection in an input can change the app's activity windowSoftInputMode param to adjustResize . This may ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found