8 |
9 |
10 |
11 | Expo Router Typescript
12 |
13 |
14 |
15 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | {children}
39 |
40 | )
41 | }
42 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "expo-router-typescript",
3 | "scripts": {
4 | "build:android": "npx eas-cli build -p android --profile preview --local",
5 | "build:ios": "npx eas-cli build -p ios --profile preview --local",
6 | "build:web": "npx expo export --platform web -c --output-dir dist",
7 | "dev": "npm run start",
8 | "format": "npx prettier src --write",
9 | "lint": "eslint src/**/*.tsx src/**/*.ts",
10 | "lint:fix": "npm run lint -- --fix",
11 | "offline": "expo start --offline",
12 | "publish:expo": "npx eas-cli update",
13 | "publish:web": "firebase deploy --only hosting",
14 | "serve:app": "expo start --dev-client",
15 | "serve:web": "npx serve dist",
16 | "setup": "npm install expo && expo install",
17 | "start": "expo start --go",
18 | "test": "jest",
19 | "upgrade": "expo upgrade",
20 | "web": "expo start --web --no-dev --host localhost --port 3000"
21 | },
22 | "overrides": {
23 | "cookie": "^0.7.0"
24 | },
25 | "dependencies": {
26 | "@react-navigation/native": "^7.0.0",
27 | "expo": "~52.0.7",
28 | "expo-dev-client": "~5.0.1",
29 | "expo-font": "~13.0.1",
30 | "expo-linking": "~7.0.2",
31 | "expo-router": "~4.0.5",
32 | "expo-status-bar": "~2.0.0",
33 | "react": "18.3.1",
34 | "react-dom": "18.3.1",
35 | "react-native": "0.76.6",
36 | "react-native-animatable": "^1.4.0",
37 | "react-native-gesture-handler": "~2.20.2",
38 | "react-native-reanimated": "~3.16.1",
39 | "react-native-safe-area-context": "4.12.0",
40 | "react-native-screens": "~4.4.0",
41 | "react-native-web": "~0.19.13",
42 | "styled-components": "^6.1.13"
43 | },
44 | "devDependencies": {
45 | "@babel/core": "^7.26.0",
46 | "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
47 | "@eslint/js": "^9.14.0",
48 | "@testing-library/jest-native": "^5.4.3",
49 | "@testing-library/react-native": "^12.8.1",
50 | "@types/jest": "^29.5.14",
51 | "@types/react": "~18.3.12",
52 | "@types/react-test-renderer": "^18.3.0",
53 | "@types/styled-components": "^5.1.34",
54 | "@types/styled-components-react-native": "^5.2.5",
55 | "@typescript-eslint/eslint-plugin": "^8.14.0",
56 | "@typescript-eslint/parser": "^8.14.0",
57 | "ajv": "^8.17.1",
58 | "babel-plugin-module-resolver": "^5.0.2",
59 | "eslint": "^9.14.0",
60 | "eslint-config-prettier": "^9.1.0",
61 | "eslint-plugin-react": "^7.37.2",
62 | "globals": "^15.12.0",
63 | "jest": "^29.7.0",
64 | "jest-expo": "~52.0.1",
65 | "prettier": "^3.3.3",
66 | "react-test-renderer": "^18.3.1",
67 | "typescript": "^5.6.3",
68 | "typescript-eslint": "^8.14.0"
69 | },
70 | "expo": {
71 | "doctor": {
72 | "reactNativeDirectoryCheck": {
73 | "listUnknownPackages": false
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | /*
2 | * For a detailed explanation regarding each configuration property, visit:
3 | * https://jestjs.io/docs/configuration
4 | */
5 |
6 | module.exports = {
7 | // All imported modules in your tests should be mocked automatically
8 | // automock: false,
9 |
10 | // Stop running tests after `n` failures
11 | bail: 5,
12 |
13 | // The directory where Jest should store its cached dependency information
14 | // cacheDirectory: "/private/var/folders/0k/2mdd_0f172zcn7scm2rktt1r0000gn/T/jest_dx",
15 |
16 | // Automatically clear mock calls, instances, contexts and results before every test
17 | clearMocks: true,
18 |
19 | // Indicates whether the coverage information should be collected while executing the test
20 | collectCoverage: true,
21 |
22 | // An array of glob patterns indicating a set of files for which coverage information should be collected
23 | // collectCoverageFrom: undefined,
24 |
25 | // The directory where Jest should output its coverage files
26 | coverageDirectory: 'coverage',
27 |
28 | // An array of regexp pattern strings used to skip coverage collection
29 | coveragePathIgnorePatterns: ['/node_modules/'],
30 |
31 | // Indicates which provider should be used to instrument code for coverage
32 | // coverageProvider: "babel",
33 |
34 | // A list of reporter names that Jest uses when writing coverage reports
35 | coverageReporters: ['html'],
36 |
37 | // An object that configures minimum threshold enforcement for coverage results
38 | // coverageThreshold: undefined,
39 |
40 | // A path to a custom dependency extractor
41 | // dependencyExtractor: undefined,
42 |
43 | // Make calling deprecated APIs throw helpful error messages
44 | // errorOnDeprecated: false,
45 |
46 | // The default configuration for fake timers
47 | // fakeTimers: {
48 | // "enableGlobally": false
49 | // },
50 |
51 | // Force coverage collection from ignored files using an array of glob patterns
52 | // forceCoverageMatch: [],
53 |
54 | // A path to a module which exports an async function that is triggered once before all test suites
55 | // globalSetup: undefined,
56 |
57 | // A path to a module which exports an async function that is triggered once after all test suites
58 | // globalTeardown: undefined,
59 |
60 | // A set of global variables that need to be available in all test environments
61 | // globals: {},
62 |
63 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
64 | // maxWorkers: "50%",
65 |
66 | // An array of directory names to be searched recursively up from the requiring module's location
67 | // moduleDirectories: [
68 | // "node_modules"
69 | // ],
70 |
71 | // An array of file extensions your modules use
72 | // moduleFileExtensions: [
73 | // "js",
74 | // "mjs",
75 | // "cjs",
76 | // "jsx",
77 | // "ts",
78 | // "tsx",
79 | // "json",
80 | // "node"
81 | // ],
82 |
83 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84 | moduleNameMapper: {
85 | '\\.(wav|mp3|m4a|aac|oga)$': '/src/assets/audio/__tests__/audio.mock.ts',
86 | '\\.(eot|otf|webp|svg|ttf|woff|woff2)$': '/src/assets/fonts/__tests__/font.mock.ts',
87 | '\\.(jpg|ico|jpeg|png|gif)$': '/src/assets/images/__tests__/image.mock.ts',
88 | '\\.(css|less)$': '/src/assets/styles/__tests__/style.mock.ts',
89 | '\\.(mp4|webm)$': '/src/assets/videos/__tests__/video.mock.ts'
90 | },
91 |
92 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
93 | // modulePathIgnorePatterns: [],
94 |
95 | // Activates notifications for test results
96 | // notify: false,
97 |
98 | // An enum that specifies notification mode. Requires { notify: true }
99 | // notifyMode: "failure-change",
100 |
101 | // A preset that is used as a base for Jest's configuration
102 | preset: 'jest-expo',
103 |
104 | // Run tests from one or more projects
105 | // projects: undefined,
106 |
107 | // Use this configuration option to add custom reporters to Jest
108 | // reporters: undefined,
109 |
110 | // Automatically reset mock state before every test
111 | // resetMocks: false,
112 |
113 | // Reset the module registry before running each individual test
114 | // resetModules: false,
115 |
116 | // A path to a custom resolver
117 | // resolver: undefined,
118 |
119 | // Automatically restore mock state and implementation before every test
120 | // restoreMocks: false,
121 |
122 | // The root directory that Jest should scan for tests and modules within
123 | // rootDir: undefined,
124 |
125 | // A list of paths to directories that Jest should use to search for files in
126 | // roots: [
127 | // ""
128 | // ],
129 |
130 | // Allows you to use a custom runner instead of Jest's default test runner
131 | // runner: "jest-runner",
132 |
133 | // The paths to modules that run some code to configure or set up the testing environment before each test
134 | // setupFiles: [],
135 |
136 | // A list of paths to modules that run some code to configure or set up the testing framework before each test
137 | setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
138 |
139 | // The number of seconds after which a test is considered as slow and reported as such in the results.
140 | // slowTestThreshold: 5,
141 |
142 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing
143 | // snapshotSerializers: [],
144 |
145 | // The test environment that will be used for testing
146 | testEnvironment: 'node',
147 |
148 | // Options that will be passed to the testEnvironment
149 | // testEnvironmentOptions: {},
150 |
151 | // Adds a location field to test results
152 | // testLocationInResults: false,
153 |
154 | // The glob patterns Jest uses to detect test files
155 | testMatch: ['**/__tests__/**/*.test.[jt]s?(x)'],
156 |
157 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
158 | testPathIgnorePatterns: ['/node_modules/'],
159 |
160 | // The regexp pattern or array of patterns that Jest uses to detect test files
161 | // testRegex: [],
162 |
163 | // This option allows the use of a custom results processor
164 | // testResultsProcessor: undefined,
165 |
166 | // This option allows use of a custom test runner
167 | // testRunner: "jest-circus/runner",
168 |
169 | // A map from regular expressions to paths to transformers
170 | // transform: undefined,
171 |
172 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
173 | transformIgnorePatterns: [
174 | 'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)'
175 | ],
176 |
177 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
178 | // unmockedModulePathPatterns: undefined,
179 |
180 | // Indicates whether each individual test should be reported during the run
181 | verbose: true
182 |
183 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
184 | // watchPathIgnorePatterns: [],
185 |
186 | // Whether to use watchman for file crawling
187 | // watchman: true,
188 | }
189 |
--------------------------------------------------------------------------------