I have faced problem in Stack Navigator in react-native

101 views Asked by At

Suppose I have 4 tab screens. The tab is created with a custom footer component with layout concept and all the navigational screens are listed in the stack navigator route section and used goBack() method to navigate the previous screen. now For a situation, my navigation route as follows started with Home->Testimonial->offerings, then again from offerings->Testimonial->about here I stopped in this screen then pressed the back button with goBack() function. but this time goBack() routes me to about->testimonial->offerings->home. Like the unique screens are listed in stack navigators routes, not the duplicate screens.

I want to know is it an issue? if yes, then how can I manage it?

1

There are 1 answers

0
Zahra Mirali On

Use a unique key for your screen.

https://reactnavigation.org/docs/navigation-actions/

   navigation.navigate({
       name: 'offerings',
       key: 'offerings' + someUniqueId,
   })