UNPKG

853 BJavaScriptView Raw
1// @flow
2
3import React from 'react';
4import { AppRegistry, StyleSheet } from 'react-native';
5
6import Constants from './Constants';
7import { processFontFamily } from './Font';
8import Notifications from './Notifications';
9
10function wrapWithExponentRoot(AppRootComponent: ReactClass<{}>) {
11 class ExponentRootComponent extends React.Component {
12 componentWillMount() {
13 StyleSheet.setStyleAttributePreprocessor('fontFamily', processFontFamily);
14
15 if (this.props.exp.notification) {
16 Notifications._setInitialNotification(this.props.exp.notification);
17 }
18 }
19
20 render() {
21 return <AppRootComponent {...this.props} />;
22 }
23 }
24
25 return ExponentRootComponent;
26}
27
28export default function registerRootComponent(component: ReactClass<{}>) {
29 AppRegistry.registerComponent('main', () => wrapWithExponentRoot(component));
30}
31
\No newline at end of file