@backpackapp-io/react-native-toast
Version:
A toasting library for React Native. Built in features such as swipe to dismiss, multiple toasts, & no context power this library.
19 lines (16 loc) • 555 B
text/typescript
import { useEffect, useState } from 'react';
import { AccessibilityInfo } from 'react-native';
export const useScreenReader = () => {
const [isScreenReaderEnabled, setIsScreenReaderEnabled] = useState(false);
useEffect(() => {
AccessibilityInfo.isScreenReaderEnabled()
.then(setIsScreenReaderEnabled)
.catch(() => {
setIsScreenReaderEnabled(false);
});
}, []);
return isScreenReaderEnabled;
};
export const announceForAccessibility = (message: string) => {
AccessibilityInfo.announceForAccessibility(message);
};