Accessibility focus - React Native

In React Native you can move accessibility focus by using the setAccessibilityFocus method from the AccessibilityInfo class. This method requires a reactTag, which you can find by calling the findNodeHandle method.

function Component() {
  const ref = useRef(null);
  
  function setFocus() {
    const reactTag = findNodeHandle(ref.current);
    
    if (reactTag) {
      AccessibilityInfo.setAccessibilityFocus(reactTag);
    }
  }

  return <View ref={ref} accessible accessibilityLabel="Modal" />
};