我想在不登录时使用堆栈导航器,然后在sıgnIn页面中使用tabnavigator
const AppNavigator=createStackNavigator({
SıgnIn:{screen:SıgnIn},
Welcome:{screen:Welcome},
SıgnUp:{screen:SıgnUp},
ForgetPassword:{screen:ForgetPassword},
});
export default class App extends Component {
render() {
return (
<AppNavigator></AppNavigator>
);
}
}
const AppTabNavigator = TabNavigator({
HomeTab:{screen:HomeTab},
Search:{screen:Search},
AddMedia:{screen:AddMedia},
Followers:{screen:Followers},
Profile:{screen:Profile},
},
它说您应该只渲染一个导航器
答案 0 :(得分:0)
我建议使用isAuthenticated
之类的布尔值来有条件地呈现您的导航器。您可以在App.js
中使用三元运算符执行以下操作:
export default class App extends Component {
render() {
return (
<div className='App'>
{ isAuthenticated ? <AppNavigator/> : <AppTabNavigator/> }
</div>
)
}
}