Skip to content

Commit

Permalink
navigation: Replace getSameRoutesCount with popToTop
Browse files Browse the repository at this point in the history
Instead of using the written by us `getSameRoutesCount` and the
standard `StackActions.pop` use the new 'StackActions.popToTop'.
  • Loading branch information
borisyankov committed May 28, 2019
1 parent d601449 commit 9b101f7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/nav/navActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
import { NavigationActions, StackActions } from 'react-navigation';

import type {
Dispatch,
NavigationAction,
GetState,
Message,
Narrow,
UserOrBot,
ApiResponseServerSettings,
} from '../types';
import { getSameRoutesCount } from '../selectors';

export const navigateBack = () => (dispatch: Dispatch, getState: GetState): NavigationAction =>
dispatch(StackActions.pop({ n: getSameRoutesCount(getState()) }));
export const navigateBack = (): NavigationAction => StackActions.popToTop({});

export const navigateToChat = (narrow: Narrow): NavigationAction =>
NavigationActions.navigate({ routeName: 'chat', params: { narrow } });
Expand Down

0 comments on commit 9b101f7

Please sign in to comment.