import { Font } from 'expo-font'; import * as React from 'react'; import { AppRegistry, StyleSheet } from 'react-native'; import Notifications from '../Notifications'; import RootErrorBoundary from './RootErrorBoundary'; type InitialProps = { exp: { notification?: any; errorRecovery?: any; [key: string]: any; }; shell?: boolean; shellManifestUrl?: string; [key: string]: any; }; function wrapWithExpoRoot
( AppRootComponent: React.ComponentClass
): React.ComponentClass
{ return class ExpoRootComponent extends React.Component
{
componentWillMount() {
StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);
if (this.props.exp.notification) {
Notifications._setInitialNotification(this.props.exp.notification);
}
}
render() {
if (__DEV__) {
return (
( component: React.ComponentClass
): void { AppRegistry.registerComponent('main', () => wrapWithExpoRoot(component)); }