Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem about pop and refresh #2860

Closed
vnext-tungns opened this issue Feb 6, 2018 · 2 comments
Closed

Problem about pop and refresh #2860

vnext-tungns opened this issue Feb 6, 2018 · 2 comments

Comments

@vnext-tungns
Copy link

vnext-tungns commented Feb 6, 2018

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.27 (v3 is not supported)
  • react-native v0.52.?

Expected behaviour

I have the situation like that. I'm in scene A and push to scene B. I want to change something in scene B and pop to scene A and scene A should be update some data (not all). I used:

Actions.pop({ refresh: { coordinates: coordinate } });

+It works well with instances where the data entered is different, but nothing changes when the same input data.

Actual behaviour

When app pass data from scene A to scene B with same data in two time, only firsttime, scene A receive data.
componentWillReceiveProps(){
console.warn('1');
}
I debug in function componentWillReceiveProps, only first time it works, in other times, componentWillReceiveProps is not call.
When i research source code, I found this function:
@action setState = async (newState) => {...}
in file react-native-router-flux/src/navigationStore.js
react-native-router-flux/dist/navigationStore
, it check status of data and prevent data receiver.
How can i fix this.

Thank you!

@vnext-tungns vnext-tungns changed the title Problem about pop and refresh 2 Problem about pop and refresh Feb 8, 2018
@esutton
Copy link

esutton commented Mar 16, 2018

This works sometimes, maybe once or twice, then componentWillReceiveProps is no longer triggered after making changes in SceneB is detail edit view

  • SceneA is list view.
  • SceneB is detail edit view
  // Detail view SceneB
  // Actions REFRESH triggers componentWillReceiveProps in parent list SceneA
  // SceneA updates state in componentWillReceiveProps
  componentWillUnmount() {
    Actions[scene.Key.SceneA]({ type: ActionConst.REFRESH });
  },

However, calling refresh in SceneB componentWillUnmount and adding an onExit to my scene that called REFRESH on itself made it reliable.

No clue why or if this is a good idea. It just seems to work.

It feels like a "house of cards" ...

            <Scene
              key={scene.Key.SceneB}
              component={props => (
                <SceneB {...props} {...this.props} />
                )}
              hideNavBar={false}
              hideTabBar={false}
              onExit={() => {
                Actions[scene.Key.SceneB]({ type: ActionConst.REFRESH });
                }}
            />

	"react": "^16.2.0",
	"react-native": "^0.53.3",
	"react-native-router-flux": "4.0.0-beta.27",

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Please try to reproduce it with Example project and latest version 4.0.0-beta.40. Feel free to open if the issue still exists

@aksonov aksonov closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants