import React, { useState, useEffect, useRef } from "react"; import { View, Text, Image, StyleSheet, Button, TouchableOpacity, TextInput, findNodeHandle, AccessibilityInfo, Switch, TouchableHighlight, Linking } from 'react-native'; import Modal from 'react-native-translucent-modal'; import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { ScrollView } from 'react-native-gesture-handler'; import Tts from 'react-native-tts'; import Slider from '@react-native-community/slider'; import Sound from 'react-native-sound'; import FocusOrder from './FocusOrder'; import AccessibilityFocus from './AccessibilityFocus'; import AccessibilityRN from './AccessibilityRN'; import { NativeEventEmitter, NativeModules } from 'react-native'; function ScreenReaderAPI({ navigation }) { return ( Accessibility Focus { navigation.navigate('API1') }}> 1. Specify which views should receive the accessibility focus { navigation.navigate('API2') }}> 2. Specify the accessibility focus order { navigation.navigate('API3') }}> 3. Assign the accessibility focus to a view { navigation.navigate('API4') }}> 4. Specify actions associated to accessibility focus-related events (e.g., a view acquires or loses the focus) { navigation.navigate('API5') }}> 5. Determine whether a view has the accessibility focus or which view has the accessibility focus Text to Announce { navigation.navigate('API6') }}> 6. Specify attributes that contribute to form the text-to-announce 7. Programmatically define the text-to-announce Not available on this platform { navigation.navigate('API8') }}> 8. Use one view to describe another one { navigation.navigate('API9') }}> 9. Specify that a view should be announced when changed, even without user interaction 10. Specify in which language the text-to-annouce should be read Not available on this platform Explicit TTS { navigation.navigate('API11') }}> 11. Read a text with the screen-reader TTS 12. Be informed when the screen-reader finishes reading an explicitly provided text. Not available on this platform 13. Customize screen-reader TTS speech features, like pitch, speed, etc... Not available on this platform { navigation.navigate('API14') }}> 14. Read a text with non-screen-reader TTS (also works when screen-reader is not active) 15. Detect whether the non-screen-reader TTS is reading Not available on this platform 16. Pause the non-screen-reader TTS Not available on this platform { navigation.navigate('API17') }}> 17. Customize non-screen-reader TTS speech features, like pitch, speed, etc... Accessibility Tree { navigation.navigate('API18') }}> 18. Aggregate multiple views into a single accessible element 19. Decompose a view into multiple accessibility elements Not available on this platform { navigation.navigate('API20') }}> 20. Get the parent accessible element Miscellaneous { navigation.navigate('API21') }}> 21. Detect whether screen-reader is active { navigation.navigate('API22') }}> 22. Support navigation by specifying which views are headers or panes { navigation.navigate('API23') }}> 23. Define how to respond to user actions that are only available when the screen reader is active { navigation.navigate('API24') }}> 24. Perform actions on user's behalf 25. Associate arbitrary accessibility-related information to a view Not available on this platform ) } function API1() { const [accessible, setAccessible] = useState(true) function setForkAccessibility() { if (accessible) { setAccessible(false) } else { setAccessible(true) } } return ( <> Press the switch to change{"\n"}the accessibility of the image ) } function API2() { const [topDown, setTopDown] = useState(true) const [text, setText] = useState('CHANGE FOCUS ORDER TO LEFT-RIGHT') const ref1 = React.useRef() const ref2 = React.useRef() const ref3 = React.useRef() const ref4 = React.useRef() function changeOrder() { if (topDown) { setTopDown(false) setText('CHANGE FOCUS ORDER TO TOP-DOWN') FocusOrder.setOrder([ findNodeHandle(ref1.current), findNodeHandle(ref3.current), findNodeHandle(ref2.current), findNodeHandle(ref4.current) ]) } else { setTopDown(true) setText('CHANGE FOCUS ORDER TO LEFT-RIGHT') FocusOrder.setOrder([ findNodeHandle(ref1.current), findNodeHandle(ref2.current), findNodeHandle(ref3.current), findNodeHandle(ref4.current) ]) } } return ( <> 1 3 2 4