Simplify <NavigationCard />.

Summary:Per offline discussion with ericvicenti,  we'd like to reudce the complexity by
keeping <NavigationCard /> nothing more than just a simple `<Animated.View />`,
which helps us to avoid over generalize the styles, gestures of what the Navigation card
needs to be.

The proposalis to use the same props (NavigationSceneRendererProps) that is used to render
the scene to generate the style and pan handlers needed for the navigation card.

No behavior changes, just implementation details clean up work.

Reviewed By: ericvicenti

Differential Revision: D3037225

fb-gh-sync-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
shipit-source-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
This commit is contained in:
Hedger Wang
2016-03-15 15:58:38 -07:00
committed by Facebook Github Bot 9
parent 6c5195fb3a
commit 28649b8cf0
11 changed files with 350 additions and 269 deletions
@@ -1,4 +1,11 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
@@ -14,7 +21,6 @@
'use strict';
const NavigationExampleRow = require('./NavigationExampleRow');
const NavigationRootContainer = require('NavigationRootContainer');
const React = require('react-native');
const {
@@ -23,10 +29,13 @@ const {
ScrollView,
} = React;
const NavigationCardStack = NavigationExperimental.CardStack;
const NavigationStateUtils = NavigationExperimental.StateUtils;
const {
CardStack: NavigationCardStack,
StateUtils: NavigationStateUtils,
RootContainer: NavigationRootContainer,
} = NavigationExperimental;
function reduceNavigationState(initialState) {
function createReducer(initialState) {
return (currentState, action) => {
switch (action.type) {
case 'RootContainerInitialAction':
@@ -47,7 +56,7 @@ function reduceNavigationState(initialState) {
};
}
const ExampleReducer = reduceNavigationState({
const ExampleReducer = createReducer({
index: 0,
key: 'exmaple',
children: [{key: 'First Route'}],