强制 withAuthenticator(App) 等待直到加载其他 App 组件

Force withAuthenticator(App) to wait until loading other App components

我是 AWS Amplify 的新手,只是不知道如何让我的 App class 等待用户签名在加载所有其他导航组件之前,然后使身份验证组件也消失。我正在使用 withAuthenticator 函数导出我的应用程序。最好的方法是什么?谢谢!

试图找到 post-登录操作的示例,但没有成功。

class App extends Component {

    constructor(props) {
        super(props);
    }

    render() {
        return (
                <Navigator />
        );
    }
}

export default withAuthenticator(App);

导航组件加载到登录屏幕上。用户登录后登录界面并没有消失,被其他组件覆盖。

我想我想出最好的方法是使用 Authenticator 而不是 withAuthenticator:

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>
    );
 }
}