react-native-a11y
Version:
Improvements of a11y for ReactNative, this library improve work with reader and keyboard focus and reader in general.
32 lines (31 loc) • 1.36 kB
TypeScript
import { RefObject } from "react";
import type { View } from "react-native";
export type A11yOrderInfo<T> = {
tag?: RefObject<View>;
views: T[];
};
export type A11yNativeModule = {
isKeyboardConnected: () => Promise<boolean>;
announceForAccessibility: (announcement: string) => void;
announceScreenChange: (announcement: string) => void;
setAccessibilityFocus: (nativeTag: number) => void;
setKeyboardFocus: (nativeTag: number, nextTag?: number) => void;
setPreferredKeyboardFocus: (nativeTag: number, nextTag: number) => void;
setA11yOrder: (tags: number[], nativeTag?: number) => void;
};
export type StatusCallback = (e: {
status: boolean;
}) => void;
export type RefObjType = RefObject<React.Component<{}, {}, unknown>>;
export interface IA11yModule {
currentFocusedTag?: number;
isKeyboardConnected: () => Promise<boolean>;
keyboardStatusListener: (callback: StatusCallback) => void;
announceForAccessibility: (announcement: string) => void;
announceScreenChange: (announcement: string) => void;
setA11yFocus: (ref: RefObjType) => void;
setPreferredKeyboardFocus: (nativeTag: number, nextTag: number) => void;
setKeyboardFocus: (ref: RefObjType) => void;
focusFirstInteractiveElement: (ref: RefObjType) => void;
setA11yElementsOrder: <T>(info: A11yOrderInfo<T>) => void;
}