Hi, what I'm trying to do is:
navigate from scene 1 to scene 2 (push) -> then do some stuff on scene 2 -> then navigate back to scene 1 (pop scene 2 and refresh params of scene1)
// 1
<Scene key="restaurantPage" hideNavBar component={RestaurantPage} />
// 2
<Scene key="verifyNumber" hideNavBar component={VerifyNumber} />
Inside RestaurantPage Actions.verifyNumber() is pushed
Then I do some stuff and I want to go back to the previous scene with new params
This doesn't seem to work, I go back to the scene 1 but there is no new params.
Actions.restaurantPage({
type: ActionConst.POP_AND_REPLACE,
showModalRedeem: true,
id: rId,
});
I've also tried this (very ugly) but doesn't work either:
Actions.pop();
setTimeout(() => {
Actions.refresh({
showModalRedeem: true,
id: rId,
});
})
Is there a way to do this?
Thanks 馃槃
Actions.pop();Actions.refresh({...}) should work. Please check Example from latest master, I've just added pop & refresh for Login 2 page.
@aksonov sorry I forgot to mention that I'm still using v3 and your suggestion doesn't seem to work.
Is it supposed to work with v3 as well?
If so, any suggestion on where I could start debugging?
Many thanks 馃槃
With a bit more testing I found that this works:
Actions.pop();
setTimeout(() => {
Actions.refresh({
showModalRedeem: true,
id: rId,
});
}, 0);
Any reason why it doesn't work without the setTimeout ?
It's a bit ugly but if it works I'm happy tbh
Thank you
Hi...
I had tried this for page1->page2->page1
Actions.pop();
setTimeout(() => {
Actions.refresh({
param : value
});
}, 0);
First time it is working fine and componentWillReceiveProps() called in page1. but second time I had again tried this.But it does not go in componentWillReceiveProps() in page1.
Anyone can help?
Thanks
Most helpful comment
With a bit more testing I found that this works:
Any reason why it doesn't work without the
setTimeout?It's a bit ugly but if it works I'm happy tbh
Thank you