Skip to content

Commit c6ce6c6

Browse files
committed
Merge branch 'master' of https://github.com/GeekyAnts/nativebase-templates into development
2 parents eaffe4d + 84c1a41 commit c6ce6c6

File tree

4 files changed

+84
-2
lines changed

4 files changed

+84
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "nextjs-with-native-base-typescript",
3+
"displayName": "nextjs-with-native-base-typescript"
4+
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
// @generated: @expo/[email protected]
2-
export { default } from '@expo/next-adapter/document';
2+
import { Children } from "react";
3+
import Document, { Html, Head, Main, NextScript } from "next/document";
4+
import { AppRegistry } from "react-native";
5+
import config from "../app.json";
6+
// Force Next-generated DOM elements to fill their parent's height
7+
const normalizeNextElements = `
8+
#__next {
9+
display: flex;
10+
flex-direction: column;
11+
height: 100%;
12+
}
13+
`;
14+
15+
export default class MyDocument extends Document {
16+
static async getInitialProps({ renderPage }) {
17+
AppRegistry.registerComponent(config.name, () => Main);
18+
const { getStyleElement } = AppRegistry.getApplication(config.name);
19+
const page = await renderPage();
20+
const styles = [
21+
// eslint-disable-next-line react/jsx-key
22+
<style dangerouslySetInnerHTML={{ __html: normalizeNextElements }} />,
23+
getStyleElement(),
24+
];
25+
return { ...page, styles: Children.toArray(styles) };
26+
}
27+
28+
render() {
29+
return (
30+
<Html style={{ height: "100%" }}>
31+
<Head />
32+
<body style={{ height: "100%", overflow: "hidden" }}>
33+
<Main />
34+
<NextScript />
35+
</body>
36+
</Html>
37+
);
38+
}
39+
}

nextjs-with-native-base/app.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "nextjs-with-native-base",
3+
"displayName": "nextjs-with-native-base"
4+
}
+38-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
// @generated: @expo/[email protected]
2-
export { default } from '@expo/next-adapter/document';
2+
import { Children } from "react";
3+
import Document, { Html, Head, Main, NextScript } from "next/document";
4+
import { AppRegistry } from "react-native";
5+
import config from "../app.json";
6+
// Force Next-generated DOM elements to fill their parent's height
7+
const normalizeNextElements = `
8+
#__next {
9+
display: flex;
10+
flex-direction: column;
11+
height: 100%;
12+
}
13+
`;
14+
15+
export default class MyDocument extends Document {
16+
static async getInitialProps({ renderPage }) {
17+
AppRegistry.registerComponent(config.name, () => Main);
18+
const { getStyleElement } = AppRegistry.getApplication(config.name);
19+
const page = await renderPage();
20+
const styles = [
21+
// eslint-disable-next-line react/jsx-key
22+
<style dangerouslySetInnerHTML={{ __html: normalizeNextElements }} />,
23+
getStyleElement(),
24+
];
25+
return { ...page, styles: Children.toArray(styles) };
26+
}
27+
28+
render() {
29+
return (
30+
<Html style={{ height: "100%" }}>
31+
<Head />
32+
<body style={{ height: "100%", overflow: "hidden" }}>
33+
<Main />
34+
<NextScript />
35+
</body>
36+
</Html>
37+
);
38+
}
39+
}

0 commit comments

Comments
 (0)