Skip to content

Commit 2013842

Browse files
committed
next 12 example with JS working
1 parent 6dc905d commit 2013842

20 files changed

+8564
-2165
lines changed

.DS_Store

0 Bytes
Binary file not shown.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/core-web-vitals", "next/babel"]
3+
}

nextjs-with-native-base/.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,27 @@ yarn-error.log*
3232

3333
# vercel
3434
.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

nextjs-with-native-base/README.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
# Example app with [native-base](https://github.com/GeekyAnts/nativebase)
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
22

3-
This example features how to use [native-base](https://github.com/GeekyAnts/nativebase) as the component library within a Next.js app.
3+
## Getting Started
44

5-
## Preview
5+
First, run the development server:
66

7-
Preview the example live on [StackBlitz](http://stackblitz.com/):
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
```
812

9-
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/with-native-base)
13+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
1014

11-
## Deploy your own
15+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
1216

13-
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
17+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
1418

15-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-native-base&project-name=with-native-base&repository-name=with-native-base)
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
1620

17-
## How to use
21+
## Learn More
1822

19-
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
23+
To learn more about Next.js, take a look at the following resources:
2024

21-
```bash
22-
npx create-next-app --example with-native-base with-native-base-app
23-
# or
24-
yarn create next-app --example with-native-base with-native-base-app
25-
```
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
2631

27-
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
2833

34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

nextjs-with-native-base/app.json

-4
This file was deleted.
+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
// @generated: @expo/[email protected]
2+
// Learn more: https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/guides/using-nextjs.md#shared-steps
3+
14
module.exports = {
2-
presets: ['next/babel'],
3-
plugins: [['react-native-web', { commonjs: true }]],
4-
}
5+
presets: ["next/babel", "@expo/next-adapter/babel"],
6+
plugins: [
7+
["@babel/plugin-proposal-private-methods", { loose: true }],
8+
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
9+
],
10+
};
+16-33
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,21 @@
1+
// @generated: @expo/[email protected]
2+
// Learn more: https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/guides/using-nextjs.md#withexpo
3+
4+
const { withExpo } = require("@expo/next-adapter");
5+
const withFonts = require("next-fonts");
16
const withPlugins = require("next-compose-plugins");
27
const withTM = require("next-transpile-modules")([
8+
"react-native-web",
39
"native-base",
4-
"react-native-svg",
5-
"react-native-safe-area-context",
6-
"@react-aria/visually-hidden",
7-
"@react-native-aria/button",
8-
"@react-native-aria/checkbox",
9-
"@react-native-aria/combobox",
10-
"@react-native-aria/focus",
11-
"@react-native-aria/interactions",
12-
"@react-native-aria/listbox",
13-
"@react-native-aria/overlays",
14-
"@react-native-aria/radio",
15-
"@react-native-aria/slider",
16-
"@react-native-aria/tabs",
17-
"@react-native-aria/utils",
18-
"@react-stately/combobox",
19-
"@react-stately/radio",
2010
]);
2111

22-
module.exports = withPlugins([withTM], {
23-
webpack: (config) => {
24-
config.resolve.alias = {
25-
...(config.resolve.alias || {}),
26-
// Transform all direct `react-native` imports to `react-native-web`
27-
"react-native$": "react-native-web",
28-
};
29-
config.resolve.extensions = [
30-
".web.js",
31-
".web.jsx",
32-
".web.ts",
33-
".web.tsx",
34-
...config.resolve.extensions,
35-
];
36-
return config;
37-
},
38-
});
12+
const nextConfig = {};
13+
14+
module.exports = withPlugins(
15+
[
16+
withTM,
17+
[withFonts, { projectRoot: __dirname }],
18+
[withExpo, { projectRoot: __dirname }],
19+
],
20+
nextConfig
21+
);

nextjs-with-native-base/package.json

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
{
2-
"name": "with-react-native-web",
2+
"name": "next-latest",
3+
"private": true,
34
"scripts": {
4-
"dev": "next",
5+
"dev": "next dev",
56
"build": "next build",
6-
"start": "next start"
7+
"start": "next start",
8+
"lint": "next lint"
79
},
810
"dependencies": {
9-
"native-base": "3.2.2",
10-
"next": "11.1.2",
11-
"react": "^17.0.2",
12-
"react-dom": "^17.0.2",
13-
"react-native-safe-area-context": "^3.2.0",
14-
"react-native-svg": "^12.1.1",
15-
"react-native-web": "^0.13.14"
11+
"@expo/vector-icons": "^12.0.5",
12+
"expo-font": "^10.0.3",
13+
"native-base": "^3.2.2",
14+
"next": "12.0.4",
15+
"react": "17.0.2",
16+
"react-dom": "17.0.2",
17+
"react-native-safe-area-context": "^3.3.2",
18+
"react-native-web": "^0.17.5"
1619
},
1720
"devDependencies": {
18-
"babel-plugin-react-native-web": "^0.13.14",
21+
"@expo/next-adapter": "^3.1.10",
22+
"babel-preset-expo": "^8.5.1",
23+
"eslint": "7",
24+
"eslint-config-next": "12.0.4",
1925
"next-compose-plugins": "^2.2.1",
20-
"next-transpile-modules": "^8.0.0"
21-
},
22-
"license": "MIT"
26+
"next-fonts": "^1.5.1",
27+
"next-transpile-modules": "^9.0.0"
28+
}
2329
}

nextjs-with-native-base/pages/_app.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import "../styles/globals.css";
2+
import { NativeBaseProvider } from "native-base";
3+
4+
function MyApp({ Component, pageProps }) {
5+
return (
6+
<NativeBaseProvider>
7+
<Component {...pageProps} />
8+
</NativeBaseProvider>
9+
);
10+
}
11+
12+
export default MyApp;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// @generated: @expo/[email protected]
2+
export { default } from '@expo/next-adapter/document';
+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+
}

nextjs-with-native-base/src/pages/index.js nextjs-with-native-base/pages/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,3 @@ function ColorModeSwitch() {
9595
</Tooltip>
9696
);
9797
}
98-
99-
25.3 KB
Binary file not shown.
Loading

nextjs-with-native-base/src/pages/_app.js

-24
This file was deleted.

nextjs-with-native-base/src/pages/_document.js

-37
This file was deleted.

nextjs-with-native-base/src/theme/index.js

-10
This file was deleted.

0 commit comments

Comments
 (0)