【问题标题】:React Native Router Flux not passing propsReact Native Router Flux 不传递道具
【发布时间】:2018-10-08 10:33:04
【问题描述】:
Environment:
"react-native": "0.57.1",
"react-native-router-flux": "^4.0.5",

当通过 Actionskey 将道具从一个屏幕传递到另一个屏幕时,它会给我一个错误,即我调用的道具未定义

我找了很多关于这个问题,但我什么也没找到

屏幕1:

<View>
  <Button 
    title="click me"
    onPress={() => Actions.Screen2({id:5})} 
  />
</View>

屏幕2:

<View>
  <Text>
    {this.props.id}
  </Text>
</View>

【问题讨论】:

  • 将 ID 作为字符串传递 onPress={() => Actions.Screen2({id:'5'})}
  • 我正在执行以下操作:Actions.createReview({ venue: this.props.venue }); 并在渲染方法中的调用组件中未定义。当我打破上面的线时,我可以看到场地对象设置了值,所以我不知道为什么它不会通过。我也尝试只传递一个像@Pramod 建议测试的字符串,但它也未定义。我想知道下面的答案是否正确,而这个库刚刚坏了?

标签: react-native react-native-router-flux


【解决方案1】:

react-native-router-flux 与最近的 React 本机版本有很多问题,还建议使用 react-navigation 作为路由方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-25
    • 1970-01-01
    • 2018-11-20
    • 1970-01-01
    相关资源
    最近更新 更多