【问题标题】:how to pass back props to Parent Component in wix Navigation如何在wix Navigation中将道具传回父组件
【发布时间】:2019-07-01 23:32:17
【问题描述】:
Navigation.push( {                      
            component: {   
                name: "Request",    
                passProps: {
                text: 'Pushed screen',
                bb1: 'anything you want here',
              } }                       
            });   

导航将传递道具推送到堆栈中的新屏幕,我想弹出带有参数的屏幕。有什么方法可以在 wix Navigation 中执行此操作,期待 redux 吗?

Navigation.pop(this.props.componentId);

【问题讨论】:

    标签: react-native navigation velo


    【解决方案1】:

    您可以通过使用回调方法来实现这一点。

    例如:

    Navigation.push( {                      
                component: {   
                    name: "Request",    
                    passProps: {
                    text: 'Pushed screen',
                    bb1: 'anything you want here',
                    callback: {(data)=>this._localMethod(data)}
                  } }                       
                });   
    
    _localMethod(data) {
     //Here you will get the data, "Data to pass"
    }
    

    在子类中,

    调用方法,

    this.props. callback("Data to pass")
    

    【讨论】:

      猜你喜欢
      • 2021-06-06
      • 2018-10-30
      • 2020-07-30
      • 2021-06-17
      • 2020-08-25
      • 2018-08-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多