React Navigation Remove current screen from stack -
React Navigation Remove current screen from stack
by on on react

React Navigation Remove current screen from stack

How to remove current Stack when Using React Navigation 5 on React Native.

To remove the current stack from route is a simple technique you need to use and do that. The replace action allows to replace a route in the navigation state. It takes the following arguments:

name - string - A destination name of the route that has been registered somewhere.

params - object - Params to merge into the destination route.

import { StackActions } from '@react-navigation/native';

navigation.dispatch(
  StackActions.replace('Profile')
);