Example #1
0
 static async getInitialProps ({ renderPage }) {
   AppRegistry.registerComponent('Main', () => Main)
   const { getStyleElement } = AppRegistry.getApplication('Main')
   const page = renderPage()
   const styles = [
     <style
       key={index++}
       dangerouslySetInnerHTML={{ __html: normalizeNextElements }}
     />,
     getStyleElement()
   ]
   return { ...page, styles }
 }
Example #2
0
 static async getInitialProps({ renderPage }) {
   AppRegistry.registerComponent('Main', () => Main);
   const { getStyleElement } = AppRegistry.getApplication('Main');
   const page = renderPage();
   const styles = [
     <style
       key={index++}
       // eslint-disable-next-line react/no-danger
       dangerouslySetInnerHTML={{ __html: normalizeNextElements }}
     />,
     getStyleElement(),
   ];
   return { ...page, styles };
 }
Example #3
0
  runApplication(code) {
    console.log('XXX Player running', code.length, 'bytes of code');

    const {AppRegistry} = require('react-native-web')

    const screenElement = this.refs.phone.getScreenNode()

    this.resetApplication()

    this.props.onRun()

    try {
      this.evaluate(code)

      // This assumes the name is MyApp. TODO: don't require that
      AppRegistry.runApplication('MyApp', {
        rootTag: screenElement,
      })
    } catch (e) {
      console.log('Failed to run MyApp', e)
      this.props.onError(e)
    }
  }