1 | import * as ErrorRecovery from 'expo-error-recovery';
|
2 | import * as React from 'react';
|
3 | import { Platform } from 'react-native';
|
4 | import Notifications from '../Notifications/Notifications';
|
5 | import RootErrorBoundary from './RootErrorBoundary';
|
6 | export 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 |
|
\ | No newline at end of file |