Skip to content

Commit e4f45da

Browse files
committed
first commit
0 parents  commit e4f45da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+12373
-0
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitignore

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel
35+
36+
# typescript
37+
*.tsbuildinfo
38+
39+
# @generated: @expo/[email protected]
40+
/.expo/*
41+
# Expo Web
42+
/web-build/*
43+
# Expo Native
44+
*.jks
45+
*.p8
46+
*.p12
47+
*.key
48+
*.mobileprovision
49+
*.orig.*
50+
# Next.js
51+
/.next/*
52+
/out/
53+
# Next.js production
54+
/build/
55+
# Next.js dependencies
56+
/.pnp
57+
.pnp.js
58+
# @end @expo/next-adapter

README.md

+34

app.json

+4
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+
}

babel.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
presets: ["@native-base/next-adapter/babel"],
3+
plugins: [
4+
["@babel/plugin-proposal-private-methods", { loose: true }],
5+
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
6+
],
7+
};

next-env.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />
3+
/// <reference types="next/image-types/global" />
4+
5+
// NOTE: This file should not be edited
6+
// see https://nextjs.org/docs/basic-features/typescript for more information.

next.config.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const { withNativebase } = require("@native-base/next-adapter");
2+
const path = require("path");
3+
4+
const nextConfig = {
5+
// reactStrictMode: true,
6+
pageExtensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js', 'api.js', 'api.ts'],
7+
images: {
8+
loader: "custom",
9+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
10+
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
11+
},
12+
env: {
13+
nextImageExportOptimizer_imageFolderPath: "public/images",
14+
nextImageExportOptimizer_exportFolderPath: "out",
15+
nextImageExportOptimizer_quality: 90,
16+
nextImageExportOptimizer_storePicturesInWEBP: true,
17+
//nextImageExportOptimizer_generateAndUseBlurImages: true,
18+
},
19+
// swcMinify: true,
20+
}
21+
22+
module.exports = withNativebase({
23+
dependencies: ["@native-base/icons", "react-native-web-linear-gradient"],
24+
nextConfig: {
25+
webpack: (config, options) => {
26+
config.module.rules.push({
27+
test: /\.ttf$/,
28+
loader: "url-loader", // or directly file-loader
29+
include: path.resolve(__dirname, "node_modules/@native-base/icons"),
30+
});
31+
config.resolve.alias = {
32+
...(config.resolve.alias || {}),
33+
"react-native$": "react-native-web",
34+
"react-native-linear-gradient": "react-native-web-linear-gradient",
35+
};
36+
config.resolve.extensions = [
37+
".web.js",
38+
".web.ts",
39+
".web.tsx",
40+
...config.resolve.extensions,
41+
];
42+
return config;
43+
},
44+
...nextConfig
45+
},
46+
});

package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@native-base/nextjs-template-typescript",
3+
"private": true,
4+
"scripts": {
5+
"dev": "next dev",
6+
"build": "next build",
7+
"start": "next start",
8+
"lint": "next lint",
9+
"image-optimize": "next-image-export-optimizer"
10+
},
11+
"dependencies": {
12+
"@native-base/icons": "^0.0.11",
13+
"expo-font": "^10.0.3",
14+
"native-base": "3.4.0",
15+
"next": "12.0.4",
16+
"next-image-export-optimizer": "^0.14.5",
17+
"react": "17.0.2",
18+
"react-dom": "17.0.2",
19+
"react-native": "^0.67.3",
20+
"react-native-safe-area-context": "^4.1.2",
21+
"react-native-svg": "^12.1.1",
22+
"react-native-web": "^0.17.7",
23+
"react-native-web-linear-gradient": "^1.1.2"
24+
},
25+
"devDependencies": {
26+
"@native-base/next-adapter": "^1.1.9",
27+
"@types/node": "16.11.11",
28+
"@types/react": "17.0.37",
29+
"@types/react-native": "^0.67.1",
30+
"babel-preset-expo": "^8.5.1",
31+
"eslint": "7",
32+
"eslint-config-next": "12.0.4",
33+
"next-compose-plugins": "^2.2.1",
34+
"next-fonts": "^1.5.1",
35+
"next-transpile-modules": "^9.0.0",
36+
"typescript": "4.5.2"
37+
}
38+
}

public/favicon.ico

25.3 KB
Binary file not shown.

public/images/nativebase-logo.svg

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"nextjs-logo.png": "QoWn6vnZcylZX5fcoyiLlEDsdsXHgh6goljRlehlJu4=",
3+
"nextjs-logo.ebfdc42e.png": "nStUqqOKBuTpcrYJqBSBk7WOkZGiPAhAYYR14O8Kr4A="
4+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

public/images/nextjs-logo.png

63.5 KB

public/vercel.svg

+4

src/pages/_app.page.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
import "../styles/globals.css";
3+
import type { AppProps } from "next/app";
4+
import { NativeBaseProvider } from "native-base";
5+
6+
function MyApp({ Component, pageProps }: AppProps) {
7+
return (
8+
<NativeBaseProvider>
9+
<Component {...pageProps} />
10+
</NativeBaseProvider>
11+
);
12+
}
13+
14+
export default MyApp;

src/pages/_document.page.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// export { default } from "@native-base/next-adapter/document";
2+
3+
import React, { Children } from "react";
4+
import NextDocument, { Html, Head, Main, NextScript } from "next/document";
5+
import { AppRegistry } from "react-native-web";
6+
7+
// Force Next-generated DOM elements to fill their parent's height
8+
const normalizeNextElements = `
9+
html, body, #__next {
10+
width: 100%;
11+
/* To smooth any scrolling behavior */
12+
-webkit-overflow-scrolling: touch;
13+
margin: 0px;
14+
padding: 0px;
15+
/* Allows content to fill the viewport and go beyond the bottom */
16+
min-height: 100%;
17+
}
18+
#__next {
19+
flex-shrink: 0;
20+
flex-basis: auto;
21+
flex-direction: column;
22+
flex-grow: 1;
23+
display: flex;
24+
flex: 1;
25+
}
26+
html {
27+
scroll-behavior: smooth;
28+
-webkit-text-size-adjust: 100%;
29+
height: 100%;
30+
}
31+
body {
32+
display: flex;
33+
overflow-y: auto;
34+
overscroll-behavior-y: none;
35+
text-rendering: optimizeLegibility;
36+
-webkit-font-smoothing: antialiased;
37+
-moz-osx-font-smoothing: grayscale;
38+
-ms-overflow-style: scrollbar;
39+
}
40+
`;
41+
42+
export async function getInitialProps({ renderPage }) {
43+
AppRegistry.registerComponent("Main", () => Main);
44+
const { getStyleElement } = AppRegistry.getApplication("Main");
45+
const page = renderPage();
46+
const styles = [
47+
// eslint-disable-next-line react/jsx-key
48+
<style dangerouslySetInnerHTML={{ __html: normalizeNextElements }} />,
49+
getStyleElement(),
50+
];
51+
return { ...page, styles: Children.toArray(styles) };
52+
}
53+
54+
class Document extends NextDocument {
55+
render() {
56+
return (
57+
<Html>
58+
<Head />
59+
<body>
60+
<Main />
61+
<NextScript />
62+
</body>
63+
</Html>
64+
);
65+
}
66+
}
67+
68+
Document.getInitialProps = getInitialProps;
69+
export default Document;

src/pages/api/hello.api.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2+
import type { NextApiRequest, NextApiResponse } from 'next'
3+
4+
type Data = {
5+
name: string
6+
}
7+
8+
export default function handler(
9+
req: NextApiRequest,
10+
res: NextApiResponse<Data>
11+
) {
12+
res.status(200).json({ name: 'John Doe' })
13+
}

0 commit comments

Comments
 (0)