Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add with-router-typescript example #423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions with-router-typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Expo Router Example

Use [`expo-router`](https://expo.github.io/router) to build native navigation using files in the `app/` directory.

## 🚀 How to use

```sh
npx create-react-native-app -t with-router-typescript
```

## 📝 Notes

- [Expo Router: Docs](https://expo.github.io/router)
- [Expo Router: Repo](https://github.com/expo/router)
- [Request for Comments](https://github.com/expo/router/discussions/1)
6 changes: 6 additions & 0 deletions with-router-typescript/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"expo": {
"scheme": "acme",
"web": { "bundler": "metro" }
}
}
11 changes: 11 additions & 0 deletions with-router-typescript/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
"@babel/plugin-proposal-export-namespace-from",
"react-native-reanimated/plugin",
require.resolve("expo-router/babel"),
],
};
};
1 change: 1 addition & 0 deletions with-router-typescript/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "expo-router/entry";
37 changes: 37 additions & 0 deletions with-router-typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"scripts": {
"start": "expo start"
},
"dependencies": {
"@types/react": "~18.0.27",
"expo": "^48.0.7",
"expo-constants": "~14.2.1",
"expo-linking": "~4.0.1",
"expo-router": "^1.2.0",
"expo-splash-screen": "~0.18.1",
"expo-status-bar": "~1.4.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.3",
"react-native-gesture-handler": "~2.9.0",
"react-native-reanimated": "~2.14.4",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-web": "~0.18.7",
"typescript": "^4.9.4"
},
"devDependencies": {
"@babel/core": "^7.19.3",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9"
},
"resolutions": {
"metro": "^0.73.7",
"metro-resolver": "^0.73.7"
},
"overrides": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"resolutions" and "overrides" are in the original package.json from with-router as well:

"resolutions": {
"metro": "^0.73.7",
"metro-resolver": "^0.73.7"
},
"overrides": {
"metro": "^0.73.7",
"metro-resolver": "^0.73.7"
},

probably some compatibility thing

"metro": "^0.73.7",
"metro-resolver": "^0.73.7"
},
"name": "with-router-typescript",
"version": "1.0.0"
}
4 changes: 4 additions & 0 deletions with-router-typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"compilerOptions": {},
"extends": "expo/tsconfig.base"
}