React Native Navigation.How to make back button take user to first stack?

109 Views Asked by At

I am trying to make the software back button of a specific stack screen of react native navigation take the user to the first stack and pop all the others.

I tried using useEffect() and useFocusEffect() but I am always getting the error: Maximum call stack size exceeded. Any help?

1

There are 1 best solutions below

0
FreakyCoder On

You can use reset functionality from react-navigation.

Here is the documentation for this:

https://reactnavigation.org/docs/1.x/navigation-actions/#reset