mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-25 23:48:54 +00:00
f81095442f
* Move all config files to './configs' * Simplify './scripts' folder.
26 lines
627 B
JavaScript
26 lines
627 B
JavaScript
import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
import { AppRegistry } from 'react-native';
|
|
|
|
export default class MyDocument extends Document {
|
|
static async getInitialProps(ctx) {
|
|
const { renderPage } = ctx;
|
|
AppRegistry.registerComponent('rn', () => Main);
|
|
const { getStyleElement } = AppRegistry.getApplication('rn');
|
|
const page = await renderPage();
|
|
const styles = getStyleElement();
|
|
return { ...page, styles };
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head />
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|