React Native: Invariant Violation: The navigation prop is missing for this navigator

前端 未结 2 709
情歌与酒
情歌与酒 2021-01-16 06:01

My code is as follows:

import React, {Component} from \'react\';
import {Platform, StyleSheet, Text, View} from \'react-native\';
import {LoginNavigator} fro         


        
2条回答
  •  星月不相逢
    2021-01-16 06:49

    In react-navigation v3, you must wrap makeRootNavigator with createAppContainer. Change your code to :

    render() {
       const Navigator = createAppContainer(makeRootNavigator(this.state.accessToken));
       return 
    }
    

    and don't forget to import createAppContainer on top of the file

    import {createSwitchNavigator, createAppContainer} from 'react-navigation'
    

提交回复
热议问题