rsnext/examples/with-expo-typescript
Tim Neutkens ed81a14922
Enable @typescript-eslint/no-use-before-define for examples dir (#39469)
Found that this rule was added but all options are set to `false` so it doesn't do anything. Started with enabling it for examples to ensure minimal breaking of existing PRs.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-10 16:30:36 +00:00
..
pages Enable @typescript-eslint/no-use-before-define for examples dir (#39469) 2022-08-10 16:30:36 +00:00
public Created Expo TypeScript example project (#13182) 2020-05-22 19:21:46 +02:00
.gitignore Update default gitignore templates (#39051) 2022-07-26 20:08:40 -05:00
App.tsx Created Expo TypeScript example project (#13182) 2020-05-22 19:21:46 +02:00
babel.config.js Created Expo TypeScript example project (#13182) 2020-05-22 19:21:46 +02:00
next-env.d.ts Include submodules in exported type definition (#28316) 2021-11-26 14:46:56 +01:00
next.config.js Fixed link for expo (#17908) 2020-10-15 15:11:35 +02:00
package.json Update typescript version (#29854) 2021-10-13 03:52:55 +00:00
README.md docs(examples): improve DX while copying command to create new project (#38410) 2022-07-26 21:57:48 -05:00
tsconfig.json Created Expo TypeScript example project (#13182) 2020-05-22 19:21:46 +02:00

With Expo TypeScript

supports iOS supports Android supports web

This is a starter project for creating universal React apps with Next.js, Expo, and TypeScript.

💡 For the most updated info, see the Expo + Next.js Docs!

iOS, Android, and web running with Expo and Next.js

  • Next.js cannot be used for SSR in your native app.
  • The native bundle is built using the Metro bundler and may not have the same level of optimization as the web bundle which is compiled using the Next.js Webpack configuration.
  • Expo transpiles react-native-web packages by default to enable the use of react-native in a browser or Node.js environment.
  • All Expo packages work in the browser. If you experience issues using them in a Node environment, please report them here: Expo issues.
  • Most community react-native-* packages do not support web, please refer to reactnative.directory for a list of web compatible packages.
  • Eject the pages/_document component by running yarn next-expo customize.
  • To use fonts and images, see the Expo docs.

Deploy your own

Deploy the example using Vercel (web only):

Deploy with Vercel

Deploy the native app to the App store and Play store using Expo deployment.

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-expo-typescript with-expo-typescript-app
yarn create next-app --example with-expo-typescript with-expo-typescript-app
pnpm create next-app --example with-expo-typescript with-expo-typescript-app

Running web

🚨 Using default Expo web with Next.js is not supported.

  • Start the Next.js project with yarn dev (yarn next dev).

Deploy the web app to the cloud with Vercel (Documentation).

Running native

  • Install the Expo CLI npm i -g expo-cli.
  • Start the Metro bundler with yarn ios or yarn android -- This runs expo start with the Expo CLI.
  • You can run the mobile app using the Expo client app, or by running yarn eject and building the project manually (this requires a macbook for iOS).

Deploy the native app to the App store and Play store using Expo deployment.

Troubleshooting

You may find that certain packages like @ui-kitten/components do not work in the browser. This is because they need to be transpiled by Next.js, you can fix this by doing the following:

  • Install the following:
yarn add -D next-compose-plugins next-transpile-modules
  • Modify the Next.js config next.config.js:
const { withExpo } = require('@expo/next-adapter')
const withPlugins = require('next-compose-plugins')
const withTM = require('next-transpile-modules')([
  // Add the name of your package here...
  '@ui-kitten/components',
])

module.exports = withPlugins([withTM, [withExpo, { projectRoot: __dirname }]], {
  // ...
})