UNPKG

1.16 kBJavaScriptView Raw
1import * as ErrorRecovery from 'expo-error-recovery';
2import * as React from 'react';
3import { Platform } from 'react-native';
4import Notifications from '../Notifications/Notifications';
5import RootErrorBoundary from './RootErrorBoundary';
6export default function withExpoRoot(AppRootComponent) {
7 return function ExpoRoot(props) {
8 const didInitialize = React.useRef(false);
9 if (!didInitialize.current) {
10 const { exp } = props;
11 if (exp.notification) {
12 Notifications._setInitialNotification(exp.notification);
13 }
14 didInitialize.current = true;
15 }
16 const combinedProps = {
17 ...props,
18 exp: { ...props.exp, errorRecovery: ErrorRecovery.recoveredProps },
19 };
20 if (__DEV__ && Platform.OS === 'android') {
21 return (React.createElement(RootErrorBoundary, null,
22 React.createElement(AppRootComponent, Object.assign({}, combinedProps))));
23 }
24 else {
25 return React.createElement(AppRootComponent, Object.assign({}, combinedProps));
26 }
27 };
28}
29//# sourceMappingURL=withExpoRoot.js.map
\No newline at end of file