react-native-a11y
Version:
Improvements of a11y for ReactNative, this library improve work with reader and keyboard focus and reader in general.
34 lines • 1.29 kB
JavaScript
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from "react";
import { View } from "react-native";
import { useFocusStyle } from "../../hooks";
import { NativeFocusWrapper } from "./RCA11yFocusWrapper";
import { useCanBeFocused } from "../../providers";
export const KeyboardFocusView = /*#__PURE__*/React.forwardRef(({
canBeFocused,
onFocusChange,
focusStyle,
children,
style,
withView = true,
onKeyUpPress,
onKeyDownPress,
...props
}, ref) => {
const canBecomeFocused = useCanBeFocused();
const {
fStyle,
onFocusChangeHandler
} = useFocusStyle(focusStyle, onFocusChange);
return /*#__PURE__*/React.createElement(NativeFocusWrapper, _extends({
onFocusChange: onFocusChangeHandler,
style: [style, fStyle],
canBeFocused: canBecomeFocused && canBeFocused,
ref: ref,
onKeyUpPress: onKeyUpPress,
onKeyDownPress: onKeyDownPress
}, props), withView ? /*#__PURE__*/React.createElement(View, {
accessible: true
}, children) : children);
});
//# sourceMappingURL=KeyboardFocusView.android.js.map