Resetting the navigation stack for the home screen (React Navigation and React Native)

前端 未结 13 2434
终归单人心
终归单人心 2020-11-29 23:49

I\'ve got a problem with the navigation of React Navigation and React Native. It is about resetting navigation and returning to the home screen.

I\'ve build a StackN

13条回答
  •  悲&欢浪女
    2020-11-30 00:19

    The pop action takes you back to a previous screen in the stack. The n param allows you to specify how many screens to pop back by.

    n - number - The number of screens to pop back by.

    import { StackActions } from 'react-navigation';

    const popAction = StackActions.pop({ n: 1, });

    this.props.navigation.dispatch(popAction);

提交回复
热议问题