React native Wix Navigation.push possible unhandled promise rejection: Error : Failed to execute stack command

React native Wix Navigation.push possible unhandled promise rejection: Error : Failed to execute stack command

React native Wix Navigation.push 可能出现未处理的 promise 拒绝:错误:无法执行堆栈命令

Login.js

signUpLink =(screenName) => {


          Navigation.push(this.props.componentId, {
  component: {
    name: screenName,
  }
});


    }

 <TouchableOpacity style={styles.buttonText}   onPress={this.signUpLink('videostreme.SignUpScreen')}>
                <Text style={styles.signUpText} >First time here?? Sign Up</Text>
                </TouchableOpacity>

index.js

Navigation.registerComponent('videostreme.LoginScreen', () => Login);
Navigation.registerComponent('videostreme.MainScreen', () => Main);
Navigation.registerComponent('videostreme.SignUpScreen', () => SignUp);
Navigation.registerComponent('videostreme.SplashScreen', () => Splash);

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
     stack: {
         children: [
         {
             component: {
                 name: 'videostreme.MainScreen'
             }
         },

         ]
     }
    }
  })
})

如何处理这个承诺(Navigation.push),有人对此有想法吗??

当我直接给 componentId 而不是 this.props.componentId 时它正在工作(当我安慰它时这是未定义的)。所以我直接给componentId,

redirectPageHandler = screenName => {
  Navigation.push('login', {
   component: {
      name: screenName
   }
  });
}

this.props.componentId未定义的原因是,我们需要从父组件传递props。

我的子组件是 Login,父组件是 App

App.js

render() {
  return (
   <Login {...this.props} />
  )
}

现在,我们可以在子组件中使用this.props.componentId

Login.js

redirectPageHandler = screenName => {
  Navigation.push(this.props.componentId, {
   component: {
      name: screenName
   }
  });
}