I got a same question as https://www.reddit.com/r/reactnative/comments/14vtimp/unmatched_route_error_on_a_route_that_does_exist/. However, the following solutions seem not working on my scenario. I got "Unmatched Route" only while I was trying to open the Android with npm start. Web working fine, which is a bit odd.
As my understanding, in expo structure, it will looks at _layout.js file, which I call out the Root Navigator. Again, web version work correctly, but got Unmatched Route while opening Android in expo app. I
I have tried to put _layout.js file under both app and outside app folder, but still doesn't work. I am thinking maybe I need to add path="app/(tabs)/_layour.js" somewhere, but I thought I already have RootNavigator.
I have a structure as:
app
├── (tabs)
└──_layout.js
├── redux
├── profile
└── mapping
components
app.json
In my _layout.js file. I do
import RootNavigator from '../../components/RootNavigator';
export default function App() {
return (
<ReduxProvider>
<RootNavigator />
</ReduxProvider>
);
}
Root Navigator
export default function RootNavigator() {
return (
<NavigationContainer >
<Stack.Navigator >
<Stack.Screen name="FirstPage" component={FirstPage} />
</Stack.Navigator>
</NavigationContainer>
);
}
Node version: 18.12.1
Expo version: 50.0.11
Any suggestions are welcome. Thank you.
I found the error message doesn't really mean anything. If codes have unsolved issues/errors, it will still show "Unmatched Route - Expo route", which not really related to "Routing" issue. I solved my issues by debugging/cleaning my codes.
I was experiencing the same error after a refactor of my components
directory, and strangley the only thing that fixed this error was renaming my root home page to index.tsx
.
(previously it was named sign-in.tsx
and was working just fine, so I can't give you a clear answer on why i had to rename it).
I saw a similar thread where someone had a similar problem and this was the same fix for them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With