Repository navigation
Description
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
Activity
pROFESOR11 commentedon Mar 5, 2022
Same here, I can confirm that on ios it works fine, but on android we have the same problem.
MohammedWaheeb commentedon Mar 5, 2022
same here
jake-ruth commentedon Mar 6, 2022
Having the same issue on Android
Cristi6 commentedon 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
maXXCZ1 commentedon Mar 7, 2022
Sadly, for me it had no impact, i am still facing same issue.
jake-ruth commentedon Mar 7, 2022
Appears to be working for me, thanks!
hafizMDM commentedon Mar 8, 2022
It is working now. Thanks
hafizMDM commentedon Mar 8, 2022
Try to clean your gradle cache. It was not working for me at first.
maXXCZ1 commentedon Mar 8, 2022
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.
kostas2231 commentedon Mar 14, 2022
sadly still facing issues with this one , nothing worked for me , what version of native-screens did you exactly used?
santoshsavorbrands commentedon 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.
kostas2231 commentedon Mar 16, 2022
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.
23 remaining items
KrisLau commentedon Mar 2, 2023
@pandyama AndroidManifest.xml exists in react native projects unless you're using expo.
pandyama commentedon Mar 2, 2023
@KrisLau sorry ya its an Expo project & i didnt know this, thanks for clarifying!
shubhraagarwal commentedon Apr 5, 2023
the solution provided here is giving me build errors
SaldanhaPrtt commentedon Oct 3, 2023
Recently encountered this issue and none of the above solutions worked. Was using RN 0.65.3, which is somewhat outdated, upgraded it to 0.66.0 and the problem just went away. Go figure.
Al-Ghozy03 commentedon Dec 20, 2023
i just change from
android:windowSoftInputMode="adjustResize">toandroid:windowSoftInputMode="adjustPan">and addreact-native-keyboard-aware-scroll-view. if i changeandroid:windowSoftInputMode="stateAlwaysHidden|adjustPan">the screen can't be scrolled. so i wrap withreact-native-keyboard-aware-scroll-viewand it worksAl-Ghozy03 commentedon Dec 21, 2023
but the drawback is you have to wrap all of your code using
react-native-keyboard-aware-scroll-viewif you want your screen can be scrolled when keyboard is activegermanmb23 commentedon Apr 21, 2024
I updated react-native from 0.64.3 to 0.66.5 and it worked like a charm. Maybe it also works with some version of 0.65.x
. I'm also using react react-native-screens.
KrisLau commentedon May 15, 2024
@germanmb23 Those versions are really old and you'll likely need to migrate to the 0.70+ versions (current is 0.74 as of writing) to avoid a lot of compatibility issues with other libraries eventually if you're not already encountering them.
mosheFuks commentedon Jul 1, 2024
I'm experiencing the same issue with react-native-screens version 3.30.1. I changed my navigation from Drawer to a combination of Drawer and Stack, and now when I tap on a TextInput, the keyboard appears but disappears after typing a couple of letters. Whatever was supposed to be saved in onChangeText also gets erased because the TextInput reverts back to displaying the placeholder value.
Any help would be greatly appreciated!
brianlenz commentedon Sep 23, 2024
In case this is of use to anyone else:
We were having the issue with the keyboard disappearing on Android with
react-navigationv6 andreact-native-screens3.34.0. We have aKeyboardAvoidingViewwith a nested<ScrollView keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag"which contains theTextInput. We use the React Native defaultandroid:windowSoftInputMode="adjustResize"inAndroidManifest.xml. The solution for us was to simply omit thebehaviorattribute in Android from theKeyboardAvoidingView:behavior={Platform.OS === 'android' ? undefined : 'padding'}. With this, the scenarios where we were consistently reproducing the issue no longer had a problem.it's unclear from the React Native docs what the default
behavioris. Ironically, they recommend you setbehavior🤷♂️I'll also mention that, for us, the issue was never reproducible 100% of the time on all devices. In fact, the vast majority of users did not have the issue. The issue appeared to only occur when the keyboard was "just the right size" to trigger the problem. As an example, in our testing, it wouldn't happen on standard Samsung Galaxy and Google Pixel setups. If you adjusted the keyboard size and/or the font size, then the issue may present itself.
- implemented react-native [keyboard fix](react/react-native#33164)
react-native-bot commentedon Mar 23, 2025
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
react-native-bot commentedon Mar 30, 2025
This issue was closed because it has been stalled for 7 days with no activity.