software-mansion / software-mansion/react-native-screens

Android keyboard focus wrong TextInput

Open
#2,965 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

platform:android repro-provided
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
  1. Navigate to the 2nd screen (ProfileScreen)
  2. Navigate to the 3rd screen (SettingsScreen)
  3. Focus TextInput in the header
  4. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.