4

I am creating an app in react-native and I have an error while using the drawer navigator and I can't seem to find out why this error is here.

the error is:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `DrawerView`. 

it has something to do with the drawer navigation I have:

const AppStack = () => {
  return (
    <Drawer.Navigator drawerContent={(props) => <DrawerContent {... props} /> } >
        <Drawer.Screen name="Map" component={MapScreen} />
    </Drawer.Navigator>
  );
}

but I just can't find out what exactly the problem is.

I have imported everything using the documentation so that is all correct.

This is the MapScreen Const:

const MapScreen = ({ navigation }) => {
    return(
      <>
        <Map/>
        <TouchableOpacity onPress={() => navigation.openDrawer()} style={styles.drawerButton}/>
        <View style={styles.mapDrawerOverlay} />
      </>
    );
  };

and the DrawerContent is another file with everything inside the drawer navigator.

is there anyone who knows what this error can be?

1
  • 1
    Do you have a component called 'DrawerView' ? Commented May 11, 2021 at 17:13

1 Answer 1

2

Check your @react-navigation/native and @react-navigation/drawer lib version they should have same version

Sign up to request clarification or add additional context in comments.

4 Comments

I have the same issue. Versions :"@react-navigation/drawer": "^6.1.4", "@react-navigation/native": "^6.0.2", How do I downgrade drawer version?
same versions didn't solve the issue
@NightOwl if your using yarn you can first remove package and then add it like yarn add package-name@version . npm is also the same
@AlbertMunichMar , check dependent library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.