UNPKG

react-native-unit-components

Version:

Unit React Native components

31 lines 1.33 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, { useEffect } from 'react'; import { Platform, View, requireNativeComponent } from 'react-native'; import { useIsJailbrokeDevice } from '../../hooks/useIsJailbrokeDevice'; import { useSnapshotProtection } from '../../hooks/useSnapshotProtection'; const UnitAndroidSecureView = requireNativeComponent('UNSecureView'); const UNBaseView = props => { useSnapshotProtection(); const isJailbroke = useIsJailbrokeDevice(); useEffect(() => { if (isJailbroke) { props.onLoadError && props.onLoadError({ errors: [{ title: 'Device is Jailbroke' }] }); } }, [props, isJailbroke]); if (isJailbroke) { return null; } if (Platform.OS == 'android') { return /*#__PURE__*/React.createElement(UnitAndroidSecureView, _extends({ filterTouchesWhenObscured: true }, props)); } else { return /*#__PURE__*/React.createElement(View, props); } }; export default UNBaseView; //# sourceMappingURL=UNBaseView.js.map