Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Android): Add focused states on page transitions (software-mansi…
…on#1894) ## Description Currently, on Android TV devices when user is switching between views the last focused child is lost. This seems like an incorrect behavior - In software-mansion#1706 people are reporting that on Android TV the last focused element should be stored. This PR introduces the change to remember last focused element on previous screen. For now I've added a statement that the last element should be stored only for Android TV, but we should discuss if we also should store those elements for classic Android - I've noticed that it's possible to focus an element on a normal screen, but I've achieved it only by switching between elements with arrows on keyboard (so is it possible to focus an element just by touching a screen? Maybe TalkBack is also focusing the elements?). <details><summary> Focusing elements on Android </summary> https://github.com/software-mansion/react-native-screens/assets/23281839/4f62ae66-f411-4c45-b678-1e47c3fa4ff2 </details> Fixes software-mansion#1706. ## Changes - Added `isTelevision` method that checks if user is currently using Android TV. - Added `lastFocusedChild` variable with an implementation for finding last focused elements. ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before https://github.com/software-mansion/react-native-screens/assets/23281839/0e3e0ad4-a202-43c3-b688-6c66f76a43f8 ### After https://github.com/software-mansion/react-native-screens/assets/23281839/998dfa5c-6def-47f2-b129-425a2257319a ## Test code and steps to reproduce You can test those changes on `Example` application by switching between examples with arrows on the keyboard. ## Checklist - [ ] Ensured that CI passes
- Loading branch information