createStackNavigation invariant violation element type is invalid expected a string

柔情痞子 提交于 2019-12-02 09:34:09

On the DLLoading_2 page

const AppContainer = createAppContainer(MainNavigation);
  • It's okay if you don't have the above code.
 constructor(props) {
    super(props);

    this.state = {};
  }
  .
  .
  .
this.props.navigation.navigate('DlMain')

 <View style={styles.root}>
        <Center />
  • Is this necessary?

    MainNavigator.js

const AppContainer = createAppContainer(MainNavigator);

export default AppContainer;

Its the problem with 'export default' and import with {} or without {}.

Change this line

import { MainNavigation } from '../screens/MainNavigator';

to (remove the curly brackets)

import  MainNavigation  from '../screens/MainNavigator';
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!