Jason Byron Beedle
Jason Byron Beedle

Reputation: 73

I am getting an error that my createDrawerNavigator is not function

I am getting the below error when I am trying to import my createDrawerNavigator The expected output is that the splash page opens on the Login screen. The appNavigator code is below.

  if (!isLoadingComplete && !props.skipLoadingScreen) {
    return (
      <AppLoading
        startAsync={loadResourcesAsync}
        onError={handleLoadingError}
        onFinish={() => handleFinishLoading(setLoadingComplete)}
      />
    );
  } else {
    return (
      <View style={styles.container}>
        {Platform.OS === 'ios' && <StatusBar barStyle="default" />}
        <AppNavigator />
      </View>
    );
  }

The error is below:

(0, _reactNavigation.DrawerNavigator) is not a function. (In '(0, _reactNavigation.DrawerNavigator)({
    Splash: _splash.default
  }, RouteConfig)', '(0, _reactNavigation.DrawerNavigator)' is undefined)

Upvotes: 0

Views: 144

Answers (1)

OriHero
OriHero

Reputation: 1228

For the v4 of react-navigation you have to install a package for drawerNavigation

yarn add react-navigation-drawer

And use it :

import { createDrawerNavigator } from 'react-navigation-drawer';

createDrawerNavigator(RouteConfigs, DrawerNavigatorConfig);

Full doc is here.

Upvotes: 1

Related Questions