mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-01 09:23:16 +08:00
Rename NavigationState to NavigationRoute, rename NavigationParentState to NavigationState.
Summary: This is the first step to clarify and simplify the type definations about navigation state. For now, `NavigationParentState` is actually used as the real navigation state and `NavigationState` is used as a route in navigation, which has been confusion among the APIs. To be clear, our APIs has no intention and interest in dealing with nested or hierarchical navigation states, and we should avoid have the name like `ParentState` or `children`. To fully migrate the types, theer will be a lot of code changes and this is just the first step to rename. = What's Next? 1. rename `navigationState.children` to `navigationState.routes` (breaking change!) 2. remove `navigationState.key` from its type defination. Reviewed By: ericvicenti Differential Revision: D3321403 fbshipit-source-id: 3e39b60f736c1135bc85d8bf2b89027d665e28d4
This commit is contained in:
committed by
Facebook Github Bot 4
parent
3977d0f5b9
commit
807726bcb4
@@ -42,7 +42,7 @@ const {
|
||||
|
||||
|
||||
import type {
|
||||
NavigationParentState,
|
||||
NavigationState,
|
||||
NavigationSceneRenderer,
|
||||
NavigationSceneRendererProps,
|
||||
} from 'NavigationTypeDefinition';
|
||||
@@ -225,7 +225,7 @@ class ExampleTabScreen extends React.Component {
|
||||
}
|
||||
|
||||
class NavigationCompositionExample extends React.Component {
|
||||
state: NavigationParentState;
|
||||
state: NavigationState;
|
||||
constructor() {
|
||||
super();
|
||||
this.state = ExampleAppReducer(undefined, {});
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -18,9 +25,9 @@
|
||||
// $FlowFixMe : This is a platform-forked component, and flow seems to only run on iOS?
|
||||
const UIExplorerList = require('./UIExplorerList');
|
||||
|
||||
import type {NavigationState} from 'NavigationTypeDefinition';
|
||||
import type {NavigationRoute} from 'NavigationTypeDefinition';
|
||||
|
||||
function StateTitleMap(state: NavigationState): string {
|
||||
function StateTitleMap(state: NavigationRoute): string {
|
||||
if (UIExplorerList.Modules[state.key]) {
|
||||
return UIExplorerList.Modules[state.key].title
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user