/** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow strict-local */ import React, {useState, useEffect} from 'react'; import { StyleSheet, TouchableOpacity, View, AccessibilityInfo, Text, } from 'react-native'; import AccessibilityFocus from './AccessibilityFocus'; const AccessibleButton = () => { const [hasFocus, setFocus] = useState(false); const text = hasFocus ? "I'm in focus" : 'Not in focus'; useEffect(() => { if (hasFocus) { AccessibilityInfo.announceForAccessibility(text); } }, [hasFocus]); return ( setFocus(true)} onFocusEnd={() => setFocus(false)}> {text} ); }; const App = () => { return ( <> RNAccessibileView Useless Button ); }; const styles = StyleSheet.create({ body: { flex: 1, paddingHorizontal: 10, justifyContent: 'center', }, btn: { padding: 10, textAlign: 'center', backgroundColor: '#ddd', }, header: { backgroundColor: '#008577', paddingHorizontal: 20, paddingVertical: 20, }, headerText: { color: 'white', }, }); export default App;