You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TextInput doesn't lose focus after dismissing keyboard on some Android devices #33532
When TextInput is focused and keyboard is shown, pressing hardware back button dismisses the keyboard but doesnt't blur the TextInput. Pressing on the TextInput again doesn't trigger the keyboard.
I noticed it happening on these devices: Mobistart V1 (android v 9), Meizu M3s (android v 5.1), Honor 8 (android v 7).
This behaviour doesn't seem to be dependant on Android version or brand.
Also this behaviour appears in every React Native app.
Expected Behavior
The TextInput should lose focus after hardware back button press.
2022-03-31.17.43.12.mp4
Version
0.65.1
Output of npx react-native info
No warnings or errors apper in console.
Steps to reproduce
Basically it happens with any TextInput.
<TextInput />
Snack, code example, screenshot, or link to a repository
No response
Reacted by sankparatkar, VasylenckoSlava, Andy Chen, Jackson Ludwig, jwallet, Ahmed Eid, Lorenzo Módolo, wongchs and ramchandra-st
Reacted by isaced, VasylenckoSlava, fragilebanana16 and lekbit
Hmm, yeah, that's unfortunate. I'm hoping the link might be helpful for you or anyone else who has time to dig into React Native's internals to find the bug and propose a fix. I'll post here if I manage to do that too. 🙂
Reacted by Gabriel Auzier, daniel-salas-angeles, VasylenckoSlava, Prutii35, Roni Castro, Le Van Thuan My, Indra Aang Fanani, Praful kumar, Harvey Randall, Ivan Harelik and 15 more
The only workaround is pressing the send/enter button the keyboard while the text input is focused. But if you have onSubmitEditing to submit a form or something, then this is not ideal.
I was able to fix it with following workaround. This perfectly loses focus after user leaves the input doesn't matter clicking any where from example from bottom back button from android etc.
Don't forget to import Keyboard from react-native 😉😉😉
Can reproduce in RN 0.81.4, Expo 54.0.12, Android 11. Every workaround mentioned (here and in #19366, namely, blur-then-focus and Keyboard.dismiss()) works though.
Activity
chrisbobbe commentedon Mar 31, 2022
Probably related (the issue is closed but still reproduces): #19366
Ol1va commentedon Apr 1, 2022
Unfortunately that solution doesn't work for me, because it suggests to make a handler for each TextInput in every React Naive project.
chrisbobbe commentedon Apr 1, 2022
Hmm, yeah, that's unfortunate. I'm hoping the link might be helpful for you or anyone else who has time to dig into React Native's internals to find the bug and propose a fix. I'll post here if I manage to do that too. 🙂
ghiculescualexandru commentedon Apr 20, 2022
Any updates on this?
Ol1va commentedon Apr 20, 2022
Unfortunately, no
ghiculescualexandru commentedon Apr 20, 2022
I managed to work around by adding a ref to the text input and a keyboard listener to blur the text input when the keyboard hide.
Here is the logic:
sankparatkar commentedon May 6, 2022
@ghiculescualexandru you did this for every TextInput box?
ghiculescualexandru commentedon May 9, 2022
Only needed it in a single place, however, you can create a component with this behaviour and use it everywhere
github-actions commentedon Nov 6, 2022
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.
jludwiggreenaction commentedon Nov 18, 2022
This is still an issue on react native v0.69.6, unsure if fixed in .7
10 remaining items
Rc85 commentedon Nov 18, 2024
The only workaround is pressing the send/enter button the keyboard while the text input is focused. But if you have onSubmitEditing to submit a form or something, then this is not ideal.
ashfaqdevdksa commentedon Dec 6, 2024
@cipolleschi @cortinico Please fix this.
muhammadashfaq commentedon Dec 9, 2024
May be it can help someone 🚀🚀🚀
I was able to fix it with following workaround. This perfectly loses focus after user leaves the input doesn't matter clicking any where from example from bottom back button from android etc.
Don't forget to import
Keyboardfromreact-native😉😉😉cipolleschi commentedon Dec 17, 2024
I just test this in a recent version (0.77.0-rc.3 and 0.76.5) of React Native and it seems to work fine.
I can:
I think this has been fixed. Can someone else test this out?
samcodefish commentedon Feb 12, 2025
Hi @cipolleschi , I think maybe you have misunderstood the issue?
The problem is that the TextInput remains focussed when the keyboard is dismissed. Which your demo illustrates.
The desired behaviour would be for the TextInput to become unfocussed when the keyboard is dismissed with the back button press.
alanggdev commentedon May 13, 2025
Any updates on this?
sayan-avantai commentedon Jun 9, 2025
any update on this?
jdziadek commentedon Jul 8, 2025
Bump
Bowuigi commentedon Oct 8, 2025
Can reproduce in RN 0.81.4, Expo 54.0.12, Android 11. Every workaround mentioned (here and in #19366, namely, blur-then-focus and
Keyboard.dismiss()) works though.ramchandra-st commentedon Feb 10, 2026
Bump
BejPastan commentedon May 22, 2026
Still doesn't work
react-native-bot commentedon Nov 19, 2026
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.
jwallet commentedon Nov 19, 2026
So this bug will stay then