UNPKG

react-native-a11y

Version:

Improvements of a11y for ReactNative, this library improve work with reader and keyboard focus and reader in general.

35 lines 1.4 kB
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, 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((_ref, ref) => { let { 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