androidreact-nativeexpo

Unmatched Route - Expo route, Android


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.


Solution

  • 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.