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
apply params state change during navigate in TabRouter #134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, can you please write a few tests that demonstrate this fix?
You can use the existing src/routers/__tests__/TabRouter-test.js
@@ -129,6 +129,10 @@ export default ( | |||
} | |||
if (activeTabIndex !== state.index) { | |||
// console.log(`${order.join('-')}: Normal navigation`, {lastIndex: state.index, newIndex: activeTabIndex}); | |||
if ( action.params ) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -129,6 +129,10 @@ export default ( | |||
} | |||
if (activeTabIndex !== state.index) { | |||
// console.log(`${order.join('-')}: Normal navigation`, {lastIndex: state.index, newIndex: activeTabIndex}); | |||
if ( action.params ) { | |||
state = {...state, routes: [...state.routes]}; | |||
state.routes[activeTabIndex] = {...state.routes[activeTabIndex], params: action.params}; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Any updates on this @danj3 ? |
I hope to attend to the changes shortly. |
any progress on this? |
This is a pretty simple and high-pri fix. @danj3, any updates? If anybody else wants to address the feedback and submit a PR for this, we can land it sooner rather than later |
Related to Issue #80
params
is not merged into state during the Navigation dispatch, so is unavailable to the Screen. I make no claim of understanding this code base, however, running through the nav transitions in the debugger led me to conclude that this is simply not handled. If it is handled then there is a documentation hole explaining how it is supposed to work, though I don't know what that would be.Test
Object transition during action with params, attached png