React-native-router-flux: How can we pass props to previous screen in Action.Pop() operation

Created on 4 Aug 2016  路  4Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v3.30.2
  • react-native v0.29.0

Expected behaviour

I am passing props to previous screen like Actions.Pop({variable: value}) on click of back button. I am not able to get the props in previous screen because there is no any component life cycle methods triggered.

can anyone please tell me which method is triggered on Action.Pop() operation and what is the way to pass props to previous screen on back button press?

Actual behaviour

In actual only popping is happened and we moved to previous screen.

Steps to reproduce

1.
2.
3.

Most helpful comment

You can pass props like this
NavigationActions.pop( {refresh: {variable: value} })
this prop change will be found in
componentWillReceivePropscallback in previous component

All 4 comments

@vykumar pop(), by definition, will bring back the previous scene with all the context that it was previously set.
Why can't you just Go to Actions.MyDesiredScene({withMyNewProps...}); .?

You can pass props like this
NavigationActions.pop( {refresh: {variable: value} })
this prop change will be found in
componentWillReceivePropscallback in previous component

@waqas19921 This is nice, but how can the "automatic" pop of the hardware back (on Android) is handled? What should we do in this case, in order for a prop to have a different value there?

Thanks!

@waqas19921 @aksonov how can we do this to receive the props in CDM

Was this page helpful?
0 / 5 - 0 ratings