-
-
Notifications
You must be signed in to change notification settings - Fork 605
Description
Description
Focus management is very important for TV applications and there's this big problem that has been hurting react-native-tvos community for a long time.
TV app users typically navigate around the UI items using their remote's d-pad. On every d-pad action, the currently focused element changes on the screen. It's crucial to restore the focus when user navigates to a different screen and then comes back to the previous one. Users should always continue their journey where they left off.
I'm assuming due to working principles react-native-screens, Android loses the track of last focused element and hence can not recover the focus natively. As a result, a new focus search begins on every page transition and focus gets lost. Here's how it looks:
Screen.Recording.2023-01-31.at.23.09.36.mov
As can be seen on the screen recording, I navigate to a screen by triggering onPress action of the (4) Text input example -- I'll call it Button 4 -- button. Later, I come back to the previous screen using the back button. Since Button 4 was the last element that had the focus on the previous screen, it should regain the focus when we navigate back.
Here's the expected behavior:
Screen.Recording.2023-01-31.at.22.57.07.mov
Steps to reproduce
- Clone https://github.com/yusufyildirim/TVInputDemo/tree/focus-bug-repro repo
- Run the app using
yarn androidcommand - Focus one of the elements on the screen and press enter to navigate to another screen
- Come back to previous screen
- See the focus is lost
Snack or a link to a repository
https://github.com/yusufyildirim/TVInputDemo/tree/focus-bug-repro repo
Screens version
3.18.2
React Native version
0.69.6
Platforms
Android
JavaScript runtime
Hermes
Workflow
None
Architecture
Paper (Old Architecture)
Build type
None
Device
Android emulator
Device model
No response
Acknowledgements
Yes