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

onEnter not being executed when using Actions.pop() manually #2147

Closed
rajsuvariya opened this issue Jul 31, 2017 · 14 comments
Closed

onEnter not being executed when using Actions.pop() manually #2147

rajsuvariya opened this issue Jul 31, 2017 · 14 comments
Labels

Comments

@rajsuvariya
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.12
  • react-native v0.46.3

Expected behavior

When I press "Add" button I am calling Actions.pop() and Actions.refresh({data: this.state.mydata}). In this case, when the previous screen becomes visible onEnter callback should be executed.

Actual behavior

When I press "Add" button I am calling Actions.pop() and Actions.refresh({data: this.state.mydata}). In this case, when the previous screen becomes visible onEnter callback is not being executed. It is being executed when I press back or Android hardware back button from second component.

Steps to reproduce

  1. Project with two component
  2. Add onEnter and onExit callbacks with console.log() in first component's scene inside router.
  3. Add a button to open the second component from first component. (call Actions.openSecondComp())
  4. In the second component add a button "Add" and on the press of this button call
     Actions.pop();
     Actions.refresh({data: "Random String"});
    
  5. Check console logs. onEnter is not being executed.
@aksonov
Copy link
Owner

aksonov commented Jul 31, 2017 via email

@rajsuvariya
Copy link
Author

rajsuvariya commented Jul 31, 2017

After taking clone of master even onExit is not working when I open the new screen using Actions.secondComp().

I have added onEnter and onExit props in loginModal in the Example.js in this repo https://github.com/rajsuvariya/react-native-router-flux Please check.

Expected Behavior and test status

  1. When login 1 scene is opened console should print 'onEnter' - passed
  2. When login 2 button is clicked console should print 'onExit' - failed
  3. When pop and refresh is clicked on login 2 console should print 'onEnter' - passed
  4. When back is pressed from login 1 console should print 'onExit' - failed

You can verify the same in the gif below

@rajsuvariya
Copy link
Author

video

@aksonov
Copy link
Owner

aksonov commented Aug 1, 2017

So only onExit doesn't work properly, right?

@aksonov aksonov added the bug label Aug 1, 2017
aksonov pushed a commit that referenced this issue Aug 1, 2017
aksonov added a commit that referenced this issue Aug 1, 2017
@rajsuvariya
Copy link
Author

Yes

@aksonov
Copy link
Owner

aksonov commented Aug 1, 2017

Please check latest master, it should be fixed

@rajsuvariya
Copy link
Author

Okay

@rajsuvariya
Copy link
Author

No, It isn't fixed yet.

image

@aksonov
Copy link
Owner

aksonov commented Aug 1, 2017

How did you test it? Are you sure that you are using latest master (not just Example from master) ?

@rajsuvariya
Copy link
Author

rajsuvariya commented Aug 1, 2017

I am using your example project only and yes I took pull from master not Example project (see the image)

You can find the project here https://github.com/rajsuvariya/react-native-router-flux

image

@aksonov
Copy link
Owner

aksonov commented Aug 1, 2017

Example uses beta.15 not latest master, that is why I asked you to change RNRF inside Example to latest one.

@rajsuvariya
Copy link
Author

I am sorry about that.

But as I am new to open source I don't know how to use the source code directly. Can you please tell me how to do it?

@aksonov
Copy link
Owner

aksonov commented Aug 1, 2017

Ok, please check latest now, I've modified dependencies directly to latest master

@rajsuvariya
Copy link
Author

Yes, It's working perfectly. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants