react-native-router-flux: Actions.pop(refresh:{}) does not work for me

Version

  • react-native-router-flux v4
  • react-native v0.55.4
  • react v16.3.1

Expected behaviour

I have screen A and Screen B when I redirect from A -> B, In B screen backing to A , I want A screen fetch data and rerender the screen everytime entering it

Actions.pop({
     refresh: {someProp: Math.random()}
})

Actual behaviour

The api methions above does not work , so I did some workaround,

Actions.pop()
setTimeout(() => {
      Actions.refresh({
        someprop: Math.random() * 100
      })
}, 10)

this can fire componentWillReceiveProps lifecycle method in A screen and I setState and rerender screen A in this way

I want to know why Actions.pop({refresh: {}}) does nothing in my case It can not even fire componentWillReceiveProps unless move it in a setTimeout function

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 17
  • Comments: 16 (6 by maintainers)

Most upvoted comments

today is 2019-08-27 , my Version react 16.8.6 react-native 0.60.5 react native router flux ^4.0.6 the problem still exists . can not fire componentWillReceiveProps . May need to adapt to the new life cycle "static getDerivedStateFromProps(props, state) " @aksonov

@atifplus Most features were broken after 4.0.0 (and I think ^4.0.0-beta.31) as that is when it changed to react-navigation ^2.0.

There’s a pull request that is being worked on which will hopefully resolve these issues soon. https://github.com/aksonov/react-native-router-flux/pull/3240