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
Typed routes not working in Expo 51 and Expo router #28680
Comments
Having the same issue after upgrading an expo project from SDK50 to 51. Also, in a fresh new project using SDK 51, switching between tabs closes Expo Go |
The crash issue you are referring to @pedrohamarques, has already been mentioned in the release notes for Expo 51 together with a workaround. #28618 |
Thank you @alfjesus , I remember reading about that issue but I totally forgot about the workaround , my bad. |
@alfjesus I had the same issue when I installed SDK 51. The Expo Go app just closes when touching the screen, simultaneously. |
I can relate. Typed routes are turned off even though |
Fixed in |
The issue still persists, I have |
Yes, I can also confirm that the issue still exist in 3.5.11 |
Confirm this exists for me as well, issue for me seems to be that it does not use the generated types but instead the base types from the expo router library. So it is missing all the project specific route types |
Yes exactly. Looks like there's something with the typescript namespace, which is defined both in the expo router lib and in the generated export namespace ExpoRouter |
Also having this issue... we were previously using As @alfjesus mentioned, SDK 51/expo-router update made a change to the generated types to be:
instead of
We were able to move forward by instead importing the namespace using: However this doesn't fix the typing of the routes |
The same for me in all 3.5.x (including 3.5.11) versions. |
I'm having the same problem too!! After upgrading to expo 51 |
I just got the same problem after upgrading to expo 51 |
@George-Acquah This issue is about typed routes in Expo Router not working. Navigation calls to defined routes is working as before with no issues. However, these routes are not typed and therefore I don't get auto completion of available routes for the But you are saying nothing seems to be working? Are you experiencing more issue than typed routes? If so I think a new issue should be filed to keep these separated. |
@alfjesus I'm stuck at the Welcome to Expo screen, and i don't know but I can't seem to go anywhere again |
@George-Acquah Sounds very strange but I don't think what you are experiencing is related to this issue I'm afraid. |
@alfjesus I dont know if i should downgrade, once i downgrade too it becomes difficult to use expo go on my mobile |
I can also confirm typed routes are not working (as far as the href prop on Link and router.navigate() from useRouter() goes). They will both accept any string. I tried deleting the .expo folder and restarting metro with --clear to ensure new types were being generated, but it still doesn't work. "expo-router": "~3.5.12",
"expo": "~51.0.4", |
Fixed in expo ~51.0.5 expo router: ~3.5.12....if build has an error delete node_modules folder and run npm install again. |
This does not seem to work for me. I'm on 51.0.5 and router 3.5.12, I nuked node_modules, deleted .expo and did a full reinstall and still no typed routes. |
Not sure if it's related but seems I can't find screens inside my (tabs) group on a production build only. Development ones works just fine with expo sdk 51. |
same here not working for me as well :) |
Same here |
Can confirm, yesterday I have bootstrapped a new Expo project with Expo Router, and typed routes are not working for me. |
Any news? |
Still same issue |
Same here.... In the meantime, a developmment build will work: https://docs.expo.dev/develop/development-builds/create-a-build/ |
Just hit this same issue today after upgrading to Expo SDK 51 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
hi there, instead of another useless type StaticRoutes = `/` | `/(app)` | `/(tabs)` | `/_sitemap` | `/apps` | `/auth` | `/confirm-email` | `/editProfile` // ... that's how routes are generated for my app, and main problem here is that they do not include folder path which makes it totally useless for non-root routes (which I have mostly all). And yeah, just confirming another pain point that now it's not clear how to import import { ExpoRouter } from 'expo-router/types/expo-router';
const route: ExpoRouter.AbsoluteRoute = 'any-wrong-path-which-ts-doesnt-care-about'; so it looks awful, and doesn't include any actual route typings. Checked on Hopefully this could be fixed soon. |
Same here.
I have an import like this I hope this will be helpful, |
It looks like the It should also do a |
For clarification: My problem with the "Welcome to Expo" default screen and no routes working after upgrading Nevertheless my generated route types also do not work. |
Same problem here. |
Minimal reproducible example
https://github.com/alfjesus/typed-routes
What platform(s) does this occur on?
No response
Did you reproduce this issue in a development build?
No (tested in Expo Go)
Summary
Creating a new project with
yarn create expo-app
(Expo 51) seems to have broken the typed routes for expo router. When I downgraded to Expo 50 (andnpx expo install --check
), typed routes started to working again. I guess there's something wrong with the generation of the types when the development server starts 🤔Environment
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - /usr/local/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.13.0 - /Users/anders/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Android Studio: 2023.2 AI-232.10300.40.2321.11567975
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.0 => 51.0.0
expo-router: ~3.5.10 => 3.5.10
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
react-native-web: ~0.19.10 => 0.19.11
npmGlobalPackages:
eas-cli: 7.8.2
Expo Workflow: managed
Expo Doctor Diagnostics
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK
Didn't find any issues with the project!
The text was updated successfully, but these errors were encountered: