react-native-a11y
Version:
Improvements of a11y for ReactNative, this library improve work with reader and keyboard focus and reader in general.
38 lines (32 loc) • 984 B
text/typescript
import type { HostComponent, ViewProps } from "react-native";
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
import {
BubblingEventHandler,
Int32,
} from "react-native/Libraries/Types/CodegenTypes";
export type FocusChange = Readonly<{
isFocused: boolean;
}>;
export type EnterPress = Readonly<{
isShiftPressed: boolean;
isAltPressed: boolean;
isEnterPress: boolean;
}>;
export type KeyPress = Readonly<{
keyCode: Int32;
isLongPress: boolean;
isAltPressed: boolean;
isShiftPressed: boolean;
isCtrlPressed: boolean;
isCapsLockOn: boolean;
hasNoModifiers: boolean;
}>;
export interface NativeProps extends ViewProps {
onFocusChange?: BubblingEventHandler<FocusChange>;
onKeyUpPress?: BubblingEventHandler<KeyPress>;
onKeyDownPress?: BubblingEventHandler<KeyPress>;
canBeFocused?: boolean;
}
export default codegenNativeComponent<NativeProps>(
"RCA11yFocusWrapper",
) as HostComponent<NativeProps>;