useAccessibilityFocus
- Description
- Params and Return
- Example
On iOS, voiceover will focus on the element closest to what the user last interacted with on the previous screen rather than what is on the top left (https://github.com/react-navigation/react-navigation/issues/7056) This hook allows you to manually set the accessibility focus on the element we know will be in the correct place.
Param / Return | Description |
---|---|
returns | Array with a ref and the function to set the ref for the accessibility focus |
How to use the useAccessibilityFocus component
const [focusRef, setFocus] = useAccessibilityFocus<View>()
useFocusEffect(setFocus)
return <HeaderTitle headerTitle={headerTitle} focusRef={focusRef} />