/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React, {useRef} from 'react';
import {
StyleSheet,
TouchableOpacity,
View,
Text,
AccessibilityInfo,
findNodeHandle,
} from 'react-native';
const App = () => {
const button3Ref = useRef(null);
const changeFocus = () => {
const tag = findNodeHandle(button3Ref.current);
AccessibilityInfo.setAccessibilityFocus(tag);
};
return (
<>
RN assign accessibility focus
Assign focus to button 3
Button 2
Button 3
>
);
};
const styles = StyleSheet.create({
body: {
flex: 1,
justifyContent: 'center',
paddingHorizontal: 10,
},
button: {
alignItems: 'center',
backgroundColor: '#DDDDDD',
padding: 10,
marginBottom: 20,
},
header: {
backgroundColor: '#008577',
paddingHorizontal: 20,
paddingVertical: 20,
},
headerText: {
color: 'white',
},
});
export default App;