Navigation Back support and examples for Android

Summary:
public
- Intro new back action
- Add support in the two main reducers
- Use it in examples to support Android back button
- Disable NavigationCard gestures on Android

Reviewed By: hedgerwang

Differential Revision: D2914154

fb-gh-sync-id: d4dce6538e19613a2ffca21e2e3b2ecaded3d5dc
shipit-source-id: d4dce6538e19613a2ffca21e2e3b2ecaded3d5dc
This commit is contained in:
Eric Vicenti
2016-02-08 20:02:45 -08:00
committed by facebook-github-bot-5
parent 7b57b5c84a
commit 7b2b0c3c1c
13 changed files with 157 additions and 54 deletions

View File

@@ -18,7 +18,11 @@ import type {
NavigationReducer,
} from 'NavigationState';
export type NavigationStackReducerAction = {
import type {
BackAction,
} from 'NavigationRootContainer';
export type NavigationStackReducerAction = BackAction | {
type: string,
};
@@ -101,6 +105,7 @@ function NavigationStackReducer({initialStates, initialIndex, key, matchAction,
action.state
);
case ActionTypes.POP:
case 'BackAction':
if (lastParentState.index === 0 || lastParentState.children.length === 1) {
return lastParentState;
}