Issue
Suppose the navigation screen stack as below:
A -> B -> C -> A
A is the current screen, and I need to navigate to the first A with parameters. I have try navigation.popToTop()
, but it can't carry parameter.
Thanks a lot in advance.
Solution
To solve this problem, I config different names A1 and A2 for the two screen A which is the same component. It is not feasible that to use replace
instead of push
as @Drew Reese commented, because there is a back button on A2 and need to navigate back to C when pressed.
A1 -> B -> C -> A2.
<MainStack.Screen name='A1' component={A} />
<MainStack.Screen name='B' component={B} />
<MainStack.Screen name='C' component={C} />
<MainStack.Screen name='A2' component={A} />
Then I can push to A2, and navigate back to A1 as requirement, B & C & A2 all pop-up.
Answered By - Saint
Answer Checked By - - Pedro (ReactFix Volunteer)