react-native icon indicating copy to clipboard operation
react-native copied to clipboard

TextInput closes automatically when opened on android

Open Cristi6 opened this issue 3 years ago • 44 comments

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

Cristi6 avatar Feb 22 '22 19:02 Cristi6

Same here, I can confirm that on ios it works fine, but on android we have the same problem.

pROFESOR11 avatar Mar 05 '22 07:03 pROFESOR11

Same here, I can confirm that on ios it works fine, but on android we have the same problem.

same here

MohammedWaheeb avatar Mar 05 '22 10:03 MohammedWaheeb

Having the same issue on Android

jake-ruth avatar Mar 06 '22 22:03 jake-ruth

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

Cristi6 avatar Mar 07 '22 06:03 Cristi6

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

Sadly, for me it had no impact, i am still facing same issue.

maXXCZ1 avatar Mar 07 '22 16:03 maXXCZ1

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

Appears to be working for me, thanks!

jake-ruth avatar Mar 07 '22 17:03 jake-ruth

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

It is working now. Thanks

hafizMDM avatar Mar 08 '22 07:03 hafizMDM

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

Sadly, for me it had no impact, i am still facing same issue.

Try to clean your gradle cache. It was not working for me at first.

hafizMDM avatar Mar 08 '22 07:03 hafizMDM

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

Sadly, for me it had no impact, i am still facing same issue.

Try to clean your gradle cache. It was not working for me at first.

Thanks, yesterday after clean i managed to run it with 3.4.0 version, today i tried 3.10.2 and it seems to work as well.

maXXCZ1 avatar Mar 08 '22 11:03 maXXCZ1

sadly still facing issues with this one , nothing worked for me , what version of native-screens did you exactly used?

kostas2231 avatar Mar 14 '22 14:03 kostas2231

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

santoshsavorbrands avatar Mar 16 '22 17:03 santoshsavorbrands

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.

kostas2231 avatar Mar 16 '22 17:03 kostas2231

Same for me too. None of the solutions worked

4RGUS avatar Mar 17 '22 07:03 4RGUS

Desafortunadamente, ninguna de las soluciones anteriores funcionó para mí. Incluso probé varias versiones de react-native-screens, pero no tuve suerte.

Finalmente, hice que funcionara, el problema que tuve fue que actualicé a 3.10.2 y no ~ 3.10.2. Darle una oportunidad. Espero que esto ayude.

Me funciono, Gracias

johana55 avatar Mar 17 '22 17:03 johana55

same issue

Also, My cardStyleInterpolator is also not working, is this issue related to react-native-screens ?

siddharth-kt avatar Mar 26 '22 22:03 siddharth-kt

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.

Saved my day S2

mvmmarcus avatar Mar 28 '22 12:03 mvmmarcus

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.

This worked for me

dooamindshine avatar Apr 05 '22 06:04 dooamindshine

Please upgrade react-native-screens to latest version. "react-native-screens": "^3.13.1". This worked for me.

jaweria-siddiqui-cygnis avatar Apr 05 '22 08:04 jaweria-siddiqui-cygnis

Not working with 3.13.1 Edited: finally worked with this 3.10.2

saad9624-tribalScale avatar Apr 05 '22 18:04 saad9624-tribalScale

When changing the version to 3.10.2 i am getting this error

Error: Unable to resolve module ./fabric

ZeeshanAhmadKhalil avatar May 01 '22 06:05 ZeeshanAhmadKhalil

Upgarde your stack and native dependencies in package.json to the latest, issue will be resolved.

DevNomadAbhi avatar May 12 '22 06:05 DevNomadAbhi

When changing the version to 3.10.2 i am getting this error

Error: Unable to resolve module ./fabric

https://stackoverflow.com/a/72298091/8989891

bilalyaqoob avatar May 19 '22 03:05 bilalyaqoob

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.

Worked like a charm....Saved my day....

akhileshsinha avatar May 23 '22 17:05 akhileshsinha

There's an open issue in react-native-screens: https://github.com/software-mansion/react-native-screens/issues/1447

KrisLau avatar Jun 01 '22 16:06 KrisLau

https://github.com/software-mansion/react-native-screens/issues/1342#issuecomment-1200315314

sadikyalcin avatar Jul 30 '22 23:07 sadikyalcin

Got the same issue but using react-native-navigation (not react-navigation), so there are no react-native-screens package. Issue was peproducing only on android 12 for input inside scroll view. FIxed by setting removeClippedSubviews={false} for android 12.

13thdeus avatar Aug 05 '22 08:08 13thdeus

Got the same issue but using react-native-navigation (not react-navigation), so there are no react-native-screens package. Issue was peproducing only on android 12 for input inside scroll view. FIxed by setting removeClippedSubviews={false} for android 12.

Thanks, this is what fixed it for me

Pureshores avatar Aug 21 '22 13:08 Pureshores

After scratching my head for hours, I find this solution that worked for me.

1: Go to your AndroidManifest.xml file update the property from this (android:windowSoftInputMode="adjustResize") to this (android:windowSoftInputMode="stateAlwaysHidden|adjustPan").

2: Re-run the project and see the magic.

Malik-Usman17 avatar Sep 24 '22 17:09 Malik-Usman17

https://stackoverflow.com/a/72298091/551744

Change the line in AndroidManifest.xml

Old line android:windowSoftInputMode="adjustResize" New line android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

olegderecha avatar Dec 07 '22 20:12 olegderecha

I have a similar issue on Android. I have an input tag inside a select element to search the select options but when I click on the input box the dropdown automatically closes I added e.stopImmediatePropagation() on the click event to stop it from closing, and it worked on all platforms except Android.

umarsabra avatar Jan 14 '23 08:01 umarsabra