Ibraheem Al-Saady
Ibraheem Al-Saady

Reputation: 874

React navigation show navigation history

I have a case where I need to see the previous route, So I have 3 pages

  1. A
  2. B
  3. C

A can navigate to C, and B can navigate to C. but in C, I have a condition that is based on the previous route, it will navigate to another page.

I'm also using Redux and Redux Sagas, so I'm navigating from the sagas using the NavigationActions like this

yield put(NavigationActions.navigate({ routeName: 'C' }));

Is it possible?

react-navigation 1.0.0-beta.11

react-native 0.46.1

node 6.9.1

npm 3.10.8

Upvotes: 2

Views: 12540

Answers (1)

Andriy Slyusar
Andriy Slyusar

Reputation: 536

In your reducer function you can have access to routes array.

function reducer(state: NavigationState, action: Action): NavigationState {
  const routes = state.routes; 
}

Upvotes: 2

Related Questions