software-mansion / software-mansion/react-native-screens
Android keyboard focus wrong TextInput
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 714
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 71
Description
Description
Stack navigator has 3 screens.
detachPreviousScreen: false.
1st screen have TextInput.
If navigate to the 3rd screen, focus TextInput in header and close 3rd screen then will be wrong result:
2nd screen is focused and TextInput from 1st screen is focused.
Worked fine until I enabled the New Architecture
I can notice that this problem appear only if TextInput inserted in the header.
https://github.com/user-attachments/assets/68ebebaf-0735-4ce8-8c18-5d68e7aac6f9
Steps to reproduce
- Navigate to the 2nd screen (ProfileScreen)
- Navigate to the 3rd screen (SettingsScreen)
- Focus TextInput in the header
- Close screen
Result:
2nd screen is opened but keyboard visible because TextInput from the 1st screen is focused
Expected result:
Keyboard should be closed
Snack or a link to a repository
https://snack.expo.dev/@bardiamist/wrong-textinput-focus
https://github.com/Bardiamist/diff/tree/navigation-text-input-focus
Screens version
4.11.1
React Native version
0.79.3
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo bare workflow
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Android emulator
Device model
No response
Acknowledgements
Yes
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the linked Snack and reproducing the focus behavior with the New Architecture, Android, and a header TextInput. Trace what happens when SettingsScreen closes and verify that the keyboard is closed and no TextInput from the first screen remains focused on ProfileScreen.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100