React native 强制withAuthenticator(应用程序)等待,直到加载其他应用程序组件

React native 强制withAuthenticator(应用程序)等待,直到加载其他应用程序组件,react-native,amazon-cognito,aws-amplify,React Native,Amazon Cognito,Aws Amplify,我是AWS Amplify的新手,只是不知道如何让我的应用程序类在加载所有其他导航组件之前等待用户登录,然后让身份验证组件也消失。我正在使用with authenticator功能导出我的应用程序。最好的方法是什么?Tkx 试图找到登录后操作的示例,但未成功 类应用程序扩展组件{ 建造师(道具){ 超级(道具); } render(){ 返回( ); } } 使用验证器导出默认值(App); 导航组件加载到登录屏幕上。用户登录后,登录屏幕不会消失,与其他组件重叠。我想我找到了最好的方法,使用A

我是AWS Amplify的新手,只是不知道如何让我的应用程序类在加载所有其他导航组件之前等待用户登录,然后让身份验证组件也消失。我正在使用
with authenticator
功能导出我的应用程序。最好的方法是什么?Tkx

试图找到登录后操作的示例,但未成功

类应用程序扩展组件{
建造师(道具){
超级(道具);
}
render(){
返回(
);
}
}
使用验证器导出默认值(App);

导航组件加载到登录屏幕上。用户登录后,登录屏幕不会消失,与其他组件重叠。

我想我找到了最好的方法,使用Authenticator而不是使用Authenticator:

class AppWithAuth extends Component {
    state = {
    authState: ''
 };

render() {
    return (
      <View style = { styles.container }>  
      <Authenticator
         amplifyConfig = {awsconf}
         onStateChange = {authState => this.setState({ authState })}
      >

      {this.state.authState === 'signedIn' && <App />}
     </View>
...
}

class App extends Component {

   render() {
   return (
     <View style = { styles.container }>
      <Navigator />
     </View>
    );
 }
}
class AppWithAuth扩展组件{
状态={
授权状态:“”
};
render(){
返回(
this.setState({authState})
>
{this.state.authState==='signedIn'&&}
...
}
类应用程序扩展组件{
render(){
返回(
);
}
}

我想我找到了最好的方法,使用Authenticator而不是使用Authenticator:

class AppWithAuth extends Component {
    state = {
    authState: ''
 };

render() {
    return (
      <View style = { styles.container }>  
      <Authenticator
         amplifyConfig = {awsconf}
         onStateChange = {authState => this.setState({ authState })}
      >

      {this.state.authState === 'signedIn' && <App />}
     </View>
...
}

class App extends Component {

   render() {
   return (
     <View style = { styles.container }>
      <Navigator />
     </View>
    );
 }
}
class AppWithAuth扩展组件{
状态={
授权状态:“”
};
render(){
返回(
this.setState({authState})
>
{this.state.authState==='signedIn'&&}
...
}
类应用程序扩展组件{
render(){
返回(
);
}
}