Rename navigationState.children to navigationState.routes.

Summary:
[Experimental API breaking changes]

The notion of `parent` or `children` in navigaton is misleading. We have no intention to maintain or
build the nested or hierarchical navigation states. To be clear, rename `navigationState.children` to
`navigationState.route`.

Reviewed By: ericvicenti

Differential Revision: D3332115

fbshipit-source-id: c72ed08acaf030fb9c60abf22fb15cc0f44b3485
This commit is contained in:
Hedger Wang
2016-05-22 16:27:53 -07:00
committed by Facebook Github Bot 2
parent 75d538e3eb
commit 1e626027f5
16 changed files with 118 additions and 111 deletions

View File

@@ -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.
*
@@ -39,7 +46,7 @@ export type UIExplorerNavigationState = {
const UIExplorerStackReducer = StackReducer({
getPushedReducerForAction: (action, lastState) => {
if (action.type === 'UIExplorerExampleAction' && UIExplorerList.Modules[action.openExample]) {
if (lastState.children.find(child => child.key === action.openExample)) {
if (lastState.routes.find(route => route.key === action.openExample)) {
// The example is already open, we should avoid pushing examples twice
return null;
}
@@ -51,7 +58,7 @@ const UIExplorerStackReducer = StackReducer({
initialState: {
key: 'UIExplorerMainStack',
index: 0,
children: [
routes: [
{key: 'AppList'},
],
},
@@ -70,7 +77,7 @@ function UIExplorerNavigationReducer(lastState: ?UIExplorerNavigationState, acti
stack: {
key: 'UIExplorerMainStack',
index: 0,
children: [
routes: [
{
key: 'AppList',
filter: action.filter,