FocusManager module provides custom focus management functionality based on You.i TV’s module.
This module aims to provide a way for you to change the way focus transitions occur between components, as compared to the default behavior in React Native. The APIs are imperative in nature as they help app developers separate business logic from layout logic.
Example usage
The following example is adapted from the You.i focus-management example code on GitHub.Methods
getFocused()
setNextFocus()
fromTag to
the component indicated by toTag.
The list of possible directions is as follows:
clearNextFocus()
fromTag.
setFocusRoot()
fromTag and its children.
focus()
tag into focus.
blur()
tag from focus.
Known issues
- Calling these APIs from the
useEffecthook can fail the first time that the component is mounted. This occurs due to a known issue in Vega whereuseEffectcan execute earlier than expected. You can work around this issue by adding a timeout/delay to youruseEffectlogic. tag*parameters of the api accept either ref or the tag of the component. However, there is an issue with typechecking if a ref is used directly. Please usefindNodeHandleas shown in example to resolve type related issues.

