From 07d24720685c02bb0ac4ace5985b0d43294a4e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fernando=20H=C3=B6wer=20Barbosa?= Date: Fri, 7 Apr 2023 15:58:56 +0200 Subject: [PATCH] Add with-router-typescript example --- with-router-typescript/README.md | 15 +++++++++++ with-router-typescript/app.json | 6 +++++ with-router-typescript/babel.config.js | 11 ++++++++ with-router-typescript/index.ts | 1 + with-router-typescript/package.json | 37 ++++++++++++++++++++++++++ with-router-typescript/tsconfig.json | 4 +++ 6 files changed, 74 insertions(+) create mode 100644 with-router-typescript/README.md create mode 100644 with-router-typescript/app.json create mode 100644 with-router-typescript/babel.config.js create mode 100644 with-router-typescript/index.ts create mode 100644 with-router-typescript/package.json create mode 100644 with-router-typescript/tsconfig.json diff --git a/with-router-typescript/README.md b/with-router-typescript/README.md new file mode 100644 index 00000000..cee66f8f --- /dev/null +++ b/with-router-typescript/README.md @@ -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) diff --git a/with-router-typescript/app.json b/with-router-typescript/app.json new file mode 100644 index 00000000..b1a56a4a --- /dev/null +++ b/with-router-typescript/app.json @@ -0,0 +1,6 @@ +{ + "expo": { + "scheme": "acme", + "web": { "bundler": "metro" } + } +} diff --git a/with-router-typescript/babel.config.js b/with-router-typescript/babel.config.js new file mode 100644 index 00000000..70119666 --- /dev/null +++ b/with-router-typescript/babel.config.js @@ -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"), + ], + }; +}; diff --git a/with-router-typescript/index.ts b/with-router-typescript/index.ts new file mode 100644 index 00000000..80d3d998 --- /dev/null +++ b/with-router-typescript/index.ts @@ -0,0 +1 @@ +import "expo-router/entry"; diff --git a/with-router-typescript/package.json b/with-router-typescript/package.json new file mode 100644 index 00000000..fc88bd39 --- /dev/null +++ b/with-router-typescript/package.json @@ -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": { + "metro": "^0.73.7", + "metro-resolver": "^0.73.7" + }, + "name": "with-router-typescript", + "version": "1.0.0" +} diff --git a/with-router-typescript/tsconfig.json b/with-router-typescript/tsconfig.json new file mode 100644 index 00000000..0e6371f6 --- /dev/null +++ b/with-router-typescript/tsconfig.json @@ -0,0 +1,4 @@ +{ + "compilerOptions": {}, + "extends": "expo/tsconfig.base" +}