Steven Dew
Steven Dew

Reputation: 31

TypeError: undefined is not an object (evaluating 'config.props')

Reloading the application on Android emulator (google pixel 5), I am receiving the following error:

screenshot of android emulator with error

TypeError: undefined is not an object (evaluating 'config.props')

This error is located at:
    in NativeStackNavigator (created by wrappedComponent)
    in wrappedComponent (created by AppNavigator)
    in EnsureSingleNavigator
    in BaseNavigationContainer
    in ThemeProvider
    in NavigationContainerInner (created by AppNavigator)
    in AppNavigator (created by App)
    in ErrorBoundary (created by App)
    in RNCSafeAreaProvider (created by SafeAreaProvider)
    in SafeAreaProvider (created by App)
    in ThemeProvider (created by App)
    in QueryClientProvider (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
at node_modules/@sentry/utils/dist/instrument.js:111:20 in <anonymous>
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/ReactFiberErrorDialog.js:43:2 in showErrorDialog

I've tried to update to the latest compatible version of react navigation.

...and expo doctor didn't find any issues with the project.

my setup:

Upvotes: 2

Views: 1983

Answers (1)

Ambroise Rabier
Ambroise Rabier

Reputation: 4082

Looking at the source code:

    const config = screens[route.name];
    const screen = config.props;

Either screens is not containing what you expect it to contain, or route.name is not what you expect.

// In case you are unfamiliar with JS

// screens[route.name]
let screens = {'hello': 33};
console.log(screens['hi']); // undefined

screens = {'hi': 33};
console.log(screens['hello']) // undefined

There is a lot of checks for screens here, so we may assume that screens is not empty.

If you are in production, you have a slightly different behavior for routes.

You are probably trying to access a route that doesn't exist.

Upvotes: 1

Related Questions