0

Hi Have a react navigation method which make a drawer, which is inside a createSwitchNavigator. But when doing the final call I am not able to render the drawer correctly. I am getting

Invariant violation error coming.

This is my drawer:
const MyDrawerNavigator = createDrawerNavigator({
    Home:{
       screen: DashboardScreen,
    },
    Notifications: {
       screen: UserMeetingScreen,
    },
  });

 const MyApp = createAppContainer(MyDrawerNavigator);

 export default MyApp

This is my stacknavigator

import AppStack from '../navigator/loggedIn';
import AuthStack from '../navigator/loggedOut';
import LoadingScreen from '../components/Loading/loading.component';

export const GetAppStack = createAppContainer(createSwitchNavigator(
    {   
        AuthLoading: LoadingScreen,
        LoggedOut: AuthStack,
        LoggedIn: AppStack,
    },
    {
        initialRouteName: 'AuthLoading',
    }
))

And this is my dashboard component

export default class DashboardScreen extends React.Component{

    static navigationOptions = {
        headerMode: 'none',
        headerStyle:{
            backgroundColor: '#4F6D7A',
            elevation: 0
        }
    }

    render(){
        return (
            <View>
                <OfflineNotice />
                <Icon 
                name= 'flight-takeoff'
                onPress= {()=> this.props.navigation.openDrawer()}
                ></Icon>
            </View>
        )
    }
}

I am getting a Element type is invalid error. Check render method of Dashboard screen. What am I doing wrong?

Jithin Zacharia
  • 341
  • 1
  • 3
  • 17

0 Answers0