mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-21 08:22:45 +08:00
Updates from Thu 26 Mar
- [React Native] Fix incorrect if-statement in RCTGeolocation | Alex Akers - [ReactNative] s/ReactKit/React/g | Tadeu Zagallo - [React Native] View border support | Nick Lockwood - [Assets] Allow scripts to override assetRoots | Amjad Masad - [ReactNative] Navigator docs | Eric Vicenti - [ReactNative] License headers and renaming | Eric Vicenti - [React Native] Add CocoaPods spec | Tadeu Zagallo - Added explicit types for all view properties | Nick Lockwood - [ReactNative] s/ReactNavigator/Navigator/ | Tadeu Zagallo - [ReactNative] Add copyright header for code copied from the jQuery UI project | Martin Konicek - [ReactNative] PanResponder documentation | Eric Vicenti
This commit is contained in:
@@ -1,16 +1,38 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* Copyright (c) 2015, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* @providesModule ReactNavigator
|
||||
* Facebook, Inc. (“Facebook”) owns all right, title and interest, including
|
||||
* all intellectual property and other proprietary rights, in and to the React
|
||||
* Native CustomComponents software (the “Software”). Subject to your
|
||||
* compliance with these terms, you are hereby granted a non-exclusive,
|
||||
* worldwide, royalty-free copyright license to (1) use and copy the Software;
|
||||
* and (2) reproduce and distribute the Software as part of your own software
|
||||
* (“Your Software”). Facebook reserves all rights not expressly granted to
|
||||
* you in this license agreement.
|
||||
*
|
||||
* THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR
|
||||
* EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @providesModule Navigator
|
||||
*/
|
||||
|
||||
"use strict"
|
||||
'use strict';
|
||||
|
||||
var AnimationsDebugModule = require('NativeModules').AnimationsDebugModule;
|
||||
var Backstack = require('Backstack');
|
||||
var Dimensions = require('Dimensions');
|
||||
var InteractionMixin = require('InteractionMixin');
|
||||
var ReactNavigatorSceneConfigs = require('ReactNavigatorSceneConfigs');
|
||||
var NavigatorSceneConfigs = require('NavigatorSceneConfigs');
|
||||
var NavigatorNavigationBar = require('NavigatorNavigationBar');
|
||||
var NavigatorBreadcrumbNavigationBar = require('NavigatorBreadcrumbNavigationBar');
|
||||
var PanResponder = require('PanResponder');
|
||||
var React = require('React');
|
||||
var StaticContainer = require('StaticContainer.react');
|
||||
@@ -72,27 +94,151 @@ var styles = StyleSheet.create({
|
||||
}
|
||||
});
|
||||
|
||||
var ReactNavigator = React.createClass({
|
||||
/**
|
||||
* Use `ReactNavigator` to transition between different scenes in your app. To
|
||||
* accomplish this, provide route objects to the navigator to identify each
|
||||
* scene, and also a `renderScene` function that the navigator can use to
|
||||
* render the scene for a given route.
|
||||
*
|
||||
* To change the animation or gesture properties of the scene, provide a
|
||||
* `configureScene` prop to get the config object for a given route. See
|
||||
* `ReactNavigator.SceneConfigs` for default animations and more info on
|
||||
* scene config options.
|
||||
*
|
||||
* ### Basic Usage
|
||||
*
|
||||
* ```
|
||||
* <ReactNavigator
|
||||
* initialRoute={{name: 'My First Scene', index: 0}}
|
||||
* renderScene={(route, navigator) =>
|
||||
* <MySceneComponent
|
||||
* name={route.name}
|
||||
* onForward={() => {
|
||||
* var nextIndex = route.index + 1;
|
||||
* navigator.push({
|
||||
* name: 'Scene ' + nextIndex,
|
||||
* index: nextIndex,
|
||||
* });
|
||||
* }}
|
||||
* onBack={() => {
|
||||
* if (route.index > 0) {
|
||||
* navigator.pop();
|
||||
* }
|
||||
* }}
|
||||
* />
|
||||
* }
|
||||
* />
|
||||
* ```
|
||||
*
|
||||
* ### Navigation Methods
|
||||
*
|
||||
* `ReactNavigator` can be told to navigate in two ways. If you have a ref to
|
||||
* the element, you can invoke several methods on it to trigger navigation:
|
||||
*
|
||||
* - `jumpBack()` - Jump backward without unmounting the current scene
|
||||
* - `jumpForward()` - Jump forward to the next scene in the route stack
|
||||
* - `jumpTo(route)` - Transition to an existing scene without unmounting
|
||||
* - `push(route)` - Navigate forward to a new scene, squashing any scenes
|
||||
* that you could `jumpForward` to
|
||||
* - `pop()` - Transition back and unmount the current scene
|
||||
* - `replace(route)` - Replace the current scene with a new route
|
||||
* - `replaceAtIndex(route, index)` - Replace a scene as specified by an index
|
||||
* - `replacePrevious(route)` - Replace the previous scene
|
||||
* - `immediatelyResetRouteStack(routeStack)` - Reset every scene with an
|
||||
* array of routes
|
||||
* - `popToRoute(route)` - Pop to a particular scene, as specified by it's
|
||||
* route. All scenes after it will be unmounted
|
||||
* - `popToTop()` - Pop to the first scene in the stack, unmounting every
|
||||
* other scene
|
||||
*
|
||||
* ### Navigator Object
|
||||
*
|
||||
* The navigator object is made available to scenes through the `renderScene`
|
||||
* function. The object has all of the navigation methods on it, as well as a
|
||||
* few utilities:
|
||||
*
|
||||
* - `parentNavigator` - a refrence to the parent navigator object that was
|
||||
* passed in through props.navigator
|
||||
* - `onWillFocus` - used to pass a navigation focus event up to the parent
|
||||
* navigator
|
||||
* - `onDidFocus` - used to pass a navigation focus event up to the parent
|
||||
* navigator
|
||||
*
|
||||
*/
|
||||
var Navigator = React.createClass({
|
||||
|
||||
propTypes: {
|
||||
/**
|
||||
* Optional function that allows configuration about scene animations and
|
||||
* gestures. Will be invoked with the route and should return a scene
|
||||
* configuration object
|
||||
*
|
||||
* ```
|
||||
* (route) => ReactNavigator.SceneConfigs.FloatFromRight
|
||||
* ```
|
||||
*/
|
||||
configureScene: PropTypes.func,
|
||||
// Returns the rendered scene to display when invoked with (route, navigator)
|
||||
|
||||
/**
|
||||
* Required function which renders the scene for a given route. Will be
|
||||
* invoked with the route, the navigator object, and a ref handler that
|
||||
* will allow a ref to your scene to be provided by props.onItemRef
|
||||
*
|
||||
* ```
|
||||
* (route, navigator, onRef) =>
|
||||
* <MySceneComponent title={route.title} ref={onRef} />
|
||||
* ```
|
||||
*/
|
||||
renderScene: PropTypes.func.isRequired,
|
||||
|
||||
/**
|
||||
* Provide a single "route" to start on. A route is an arbitrary object
|
||||
* that the navigator will use to identify each scene before rendering.
|
||||
* Either initialRoute or initialRouteStack is required.
|
||||
*/
|
||||
initialRoute: PropTypes.object,
|
||||
|
||||
/**
|
||||
* Provide a set of routes to initially mount the scenes for. Required if no
|
||||
* initialRoute is provided
|
||||
*/
|
||||
initialRouteStack: PropTypes.arrayOf(PropTypes.object),
|
||||
// Will emit the target route on mounting and before each nav transition,
|
||||
// overriding the handler in this.props.navigator
|
||||
|
||||
/**
|
||||
* Will emit the target route upon mounting and before each nav transition,
|
||||
* overriding the handler in this.props.navigator. This overrides the onDidFocus
|
||||
* handler that would be found in this.props.navigator
|
||||
*/
|
||||
onWillFocus: PropTypes.func,
|
||||
// Will emit the new route after mounting and after each nav transition,
|
||||
// overriding the handler in this.props.navigator
|
||||
|
||||
/**
|
||||
* Will be called with the new route of each scene after the transition is
|
||||
* complete or after the initial mounting. This overrides the onDidFocus
|
||||
* handler that would be found in this.props.navigator
|
||||
*/
|
||||
onDidFocus: PropTypes.func,
|
||||
// Will be called with (ref, indexInStack) when an item ref resolves
|
||||
|
||||
/**
|
||||
* Will be called with (ref, indexInStack) when the scene ref changes
|
||||
*/
|
||||
onItemRef: PropTypes.func,
|
||||
// Define the component to use for the nav bar, which will get navState and navigator props
|
||||
|
||||
/**
|
||||
* Optionally provide a navigation bar that persists across scene
|
||||
* transitions
|
||||
*/
|
||||
navigationBar: PropTypes.node,
|
||||
// The navigator object from a parent ReactNavigator
|
||||
|
||||
/**
|
||||
* Optionally provide the navigator object from a parent ReactNavigator
|
||||
*/
|
||||
navigator: PropTypes.object,
|
||||
|
||||
/**
|
||||
* Styles to apply to the container of each scene
|
||||
*/
|
||||
sceneStyle: View.propTypes.style,
|
||||
|
||||
/**
|
||||
* Should the backstack back button "jump" back instead of pop? Set to true
|
||||
* if a jump forward might happen after the android back button is pressed,
|
||||
@@ -102,14 +248,16 @@ var ReactNavigator = React.createClass({
|
||||
},
|
||||
|
||||
statics: {
|
||||
SceneConfigs: ReactNavigatorSceneConfigs,
|
||||
BreadcrumbNavigationBar: NavigatorBreadcrumbNavigationBar,
|
||||
NavigationBar: NavigatorNavigationBar,
|
||||
SceneConfigs: NavigatorSceneConfigs,
|
||||
},
|
||||
|
||||
mixins: [TimerMixin, InteractionMixin, Subscribable.Mixin],
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
configureScene: () => ReactNavigatorSceneConfigs.PushFromRight,
|
||||
configureScene: () => NavigatorSceneConfigs.PushFromRight,
|
||||
sceneStyle: styles.defaultSceneStyle,
|
||||
};
|
||||
},
|
||||
@@ -128,7 +276,7 @@ var ReactNavigator = React.createClass({
|
||||
} else {
|
||||
invariant(
|
||||
routeStack.length >= 1,
|
||||
'ReactNavigator requires props.initialRoute or props.initialRouteStack.'
|
||||
'Navigator requires props.initialRoute or props.initialRouteStack.'
|
||||
);
|
||||
}
|
||||
return {
|
||||
@@ -151,7 +299,7 @@ var ReactNavigator = React.createClass({
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
this.memoizedNavigationOperations = {
|
||||
this.navigatorActions = {
|
||||
jumpBack: this.jumpBack,
|
||||
jumpForward: this.jumpForward,
|
||||
jumpTo: this.jumpTo,
|
||||
@@ -166,8 +314,9 @@ var ReactNavigator = React.createClass({
|
||||
popToRoute: this.popToRoute,
|
||||
popToTop: this.popToTop,
|
||||
parentNavigator: this.props.navigator,
|
||||
// We want to bubble focused routes to the top navigation stack. If we are
|
||||
// a child, this will allow us to call this.props.navigator.on*Focus
|
||||
// We want to bubble focused routes to the top navigation stack. If we
|
||||
// are a child navigator, this allows us to call props.navigator.on*Focus
|
||||
// of the topmost ReactNavigator
|
||||
onWillFocus: this.props.onWillFocus,
|
||||
onDidFocus: this.props.onDidFocus,
|
||||
};
|
||||
@@ -798,7 +947,7 @@ var ReactNavigator = React.createClass({
|
||||
i <= this.state.updatingRangeStart + this.state.updatingRangeLength;
|
||||
var child = this.props.renderScene(
|
||||
route,
|
||||
this.memoizedNavigationOperations,
|
||||
this.navigatorActions,
|
||||
this._onItemRef.bind(null, this.state.idStack[i])
|
||||
);
|
||||
|
||||
@@ -842,7 +991,7 @@ var ReactNavigator = React.createClass({
|
||||
}
|
||||
return React.cloneElement(this.props.navigationBar, {
|
||||
ref: NAVIGATION_BAR_REF,
|
||||
navigator: this.memoizedNavigationOperations,
|
||||
navigator: this.navigatorActions,
|
||||
navState: this.state,
|
||||
});
|
||||
},
|
||||
@@ -857,4 +1006,4 @@ var ReactNavigator = React.createClass({
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = ReactNavigator;
|
||||
module.exports = Navigator;
|
||||
@@ -1,19 +1,18 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule BreadcrumbNavigationBar
|
||||
* @providesModule NavigatorBreadcrumbNavigationBar
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var BreadcrumbNavigationBarStyles = require('BreadcrumbNavigationBarStyles');
|
||||
var PixelRatio = require('PixelRatio');
|
||||
var NavigatorBreadcrumbNavigationBarStyles = require('NavigatorBreadcrumbNavigationBarStyles');
|
||||
var NavigatorNavigationBarStyles = require('NavigatorNavigationBarStyles');
|
||||
var React = require('React');
|
||||
var NavigationBarStyles = require('NavigationBarStyles');
|
||||
var StaticContainer = require('StaticContainer.react');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var View = require('View');
|
||||
|
||||
var Interpolators = BreadcrumbNavigationBarStyles.Interpolators;
|
||||
var Interpolators = NavigatorBreadcrumbNavigationBarStyles.Interpolators;
|
||||
var PropTypes = React.PropTypes;
|
||||
|
||||
/**
|
||||
@@ -46,12 +45,12 @@ var navStatePresentedIndex = function(navState) {
|
||||
* @return {object} Style config for initial rendering of index.
|
||||
*/
|
||||
var initStyle = function(index, presentedIndex) {
|
||||
return index === presentedIndex ? BreadcrumbNavigationBarStyles.Center[index] :
|
||||
index < presentedIndex ? BreadcrumbNavigationBarStyles.Left[index] :
|
||||
BreadcrumbNavigationBarStyles.Right[index];
|
||||
return index === presentedIndex ? NavigatorBreadcrumbNavigationBarStyles.Center[index] :
|
||||
index < presentedIndex ? NavigatorBreadcrumbNavigationBarStyles.Left[index] :
|
||||
NavigatorBreadcrumbNavigationBarStyles.Right[index];
|
||||
};
|
||||
|
||||
var BreadcrumbNavigationBar = React.createClass({
|
||||
var NavigatorBreadcrumbNavigationBar = React.createClass({
|
||||
propTypes: {
|
||||
navigator: PropTypes.shape({
|
||||
push: PropTypes.func,
|
||||
@@ -68,6 +67,10 @@ var BreadcrumbNavigationBar = React.createClass({
|
||||
navigationBarStyles: PropTypes.number,
|
||||
},
|
||||
|
||||
statics: {
|
||||
Styles: NavigatorBreadcrumbNavigationBarStyles,
|
||||
},
|
||||
|
||||
_updateIndexProgress: function(progress, index, fromIndex, toIndex) {
|
||||
var amount = toIndex > fromIndex ? progress : (1 - progress);
|
||||
var oldDistToCenter = index - fromIndex;
|
||||
@@ -231,11 +234,11 @@ var styles = StyleSheet.create({
|
||||
breadCrumbContainer: {
|
||||
overflow: 'hidden',
|
||||
position: 'absolute',
|
||||
height: NavigationBarStyles.General.TotalNavHeight,
|
||||
height: NavigatorNavigationBarStyles.General.TotalNavHeight,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: NavigationBarStyles.General.ScreenWidth,
|
||||
width: NavigatorNavigationBarStyles.General.ScreenWidth,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = BreadcrumbNavigationBar;
|
||||
module.exports = NavigatorBreadcrumbNavigationBar;
|
||||
@@ -1,18 +1,39 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* Copyright (c) 2015, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* @providesModule BreadcrumbNavigationBarStyles
|
||||
* Facebook, Inc. (“Facebook”) owns all right, title and interest, including
|
||||
* all intellectual property and other proprietary rights, in and to the React
|
||||
* Native CustomComponents software (the “Software”). Subject to your
|
||||
* compliance with these terms, you are hereby granted a non-exclusive,
|
||||
* worldwide, royalty-free copyright license to (1) use and copy the Software;
|
||||
* and (2) reproduce and distribute the Software as part of your own software
|
||||
* (“Your Software”). Facebook reserves all rights not expressly granted to
|
||||
* you in this license agreement.
|
||||
*
|
||||
* THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR
|
||||
* EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @providesModule NavigatorBreadcrumbNavigationBarStyles
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var NavigationBarStyles = require('NavigationBarStyles');
|
||||
var NavigatorNavigationBarStyles = require('NavigatorNavigationBarStyles');
|
||||
|
||||
var buildStyleInterpolator = require('buildStyleInterpolator');
|
||||
var merge = require('merge');
|
||||
|
||||
var SCREEN_WIDTH = NavigationBarStyles.General.ScreenWidth;
|
||||
var STATUS_BAR_HEIGHT = NavigationBarStyles.General.StatusBarHeight;
|
||||
var NAV_BAR_HEIGHT = NavigationBarStyles.General.NavBarHeight;
|
||||
var SCREEN_WIDTH = NavigatorNavigationBarStyles.General.ScreenWidth;
|
||||
var STATUS_BAR_HEIGHT = NavigatorNavigationBarStyles.General.StatusBarHeight;
|
||||
var NAV_BAR_HEIGHT = NavigatorNavigationBarStyles.General.NavBarHeight;
|
||||
|
||||
var SPACING = 4;
|
||||
var ICON_WIDTH = 40;
|
||||
@@ -1,15 +1,36 @@
|
||||
/**
|
||||
* @providesModule NavigationBar
|
||||
* @typechecks
|
||||
* Copyright (c) 2015, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* Facebook, Inc. (“Facebook”) owns all right, title and interest, including
|
||||
* all intellectual property and other proprietary rights, in and to the React
|
||||
* Native CustomComponents software (the “Software”). Subject to your
|
||||
* compliance with these terms, you are hereby granted a non-exclusive,
|
||||
* worldwide, royalty-free copyright license to (1) use and copy the Software;
|
||||
* and (2) reproduce and distribute the Software as part of your own software
|
||||
* (“Your Software”). Facebook reserves all rights not expressly granted to
|
||||
* you in this license agreement.
|
||||
*
|
||||
* THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR
|
||||
* EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @providesModule NavigatorNavigationBar
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var React = require('React');
|
||||
var NavigationBarStyles = require('NavigationBarStyles');
|
||||
var NavigatorNavigationBarStyles = require('NavigatorNavigationBarStyles');
|
||||
var StaticContainer = require('StaticContainer.react');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var View = require('View');
|
||||
var Text = require('Text');
|
||||
|
||||
var COMPONENT_NAMES = ['Title', 'LeftButton', 'RightButton'];
|
||||
|
||||
@@ -24,7 +45,11 @@ var navStatePresentedIndex = function(navState) {
|
||||
}
|
||||
};
|
||||
|
||||
var NavigationBar = React.createClass({
|
||||
var NavigatorNavigationBar = React.createClass({
|
||||
|
||||
statics: {
|
||||
Styles: NavigatorNavigationBarStyles,
|
||||
},
|
||||
|
||||
_getReusableProps: function(
|
||||
/*string*/componentName,
|
||||
@@ -32,7 +57,7 @@ var NavigationBar = React.createClass({
|
||||
) /*object*/ {
|
||||
if (!this._reusableProps) {
|
||||
this._reusableProps = {};
|
||||
};
|
||||
}
|
||||
var propStack = this._reusableProps[componentName];
|
||||
if (!propStack) {
|
||||
propStack = this._reusableProps[componentName] = [];
|
||||
@@ -56,14 +81,14 @@ var NavigationBar = React.createClass({
|
||||
var interpolate;
|
||||
if (oldDistToCenter > 0 && newDistToCenter === 0 ||
|
||||
newDistToCenter > 0 && oldDistToCenter === 0) {
|
||||
interpolate = NavigationBarStyles.Interpolators.RightToCenter;
|
||||
interpolate = NavigatorNavigationBarStyles.Interpolators.RightToCenter;
|
||||
} else if (oldDistToCenter < 0 && newDistToCenter === 0 ||
|
||||
newDistToCenter < 0 && oldDistToCenter === 0) {
|
||||
interpolate = NavigationBarStyles.Interpolators.CenterToLeft;
|
||||
interpolate = NavigatorNavigationBarStyles.Interpolators.CenterToLeft;
|
||||
} else if (oldDistToCenter === newDistToCenter) {
|
||||
interpolate = NavigationBarStyles.Interpolators.RightToCenter;
|
||||
interpolate = NavigatorNavigationBarStyles.Interpolators.RightToCenter;
|
||||
} else {
|
||||
interpolate = NavigationBarStyles.Interpolators.RightToLeft;
|
||||
interpolate = NavigatorNavigationBarStyles.Interpolators.RightToLeft;
|
||||
}
|
||||
|
||||
COMPONENT_NAMES.forEach(function (componentName) {
|
||||
@@ -134,7 +159,7 @@ var NavigationBar = React.createClass({
|
||||
}
|
||||
|
||||
var initialStage = index === navStatePresentedIndex(this.props.navState) ?
|
||||
NavigationBarStyles.Stages.Center : NavigationBarStyles.Stages.Left;
|
||||
NavigatorNavigationBarStyles.Stages.Center : NavigatorNavigationBarStyles.Stages.Left;
|
||||
return (
|
||||
<StaticContainer
|
||||
ref={containerRef}
|
||||
@@ -153,12 +178,12 @@ var NavigationBar = React.createClass({
|
||||
var styles = StyleSheet.create({
|
||||
navBarContainer: {
|
||||
position: 'absolute',
|
||||
height: NavigationBarStyles.General.TotalNavHeight,
|
||||
height: NavigatorNavigationBarStyles.General.TotalNavHeight,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: NavigationBarStyles.General.ScreenWidth,
|
||||
width: NavigatorNavigationBarStyles.General.ScreenWidth,
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = NavigationBar;
|
||||
module.exports = NavigatorNavigationBar;
|
||||
@@ -1,7 +1,28 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* Copyright (c) 2015, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* @providesModule NavigationBarStyles
|
||||
* Facebook, Inc. (“Facebook”) owns all right, title and interest, including
|
||||
* all intellectual property and other proprietary rights, in and to the React
|
||||
* Native CustomComponents software (the “Software”). Subject to your
|
||||
* compliance with these terms, you are hereby granted a non-exclusive,
|
||||
* worldwide, royalty-free copyright license to (1) use and copy the Software;
|
||||
* and (2) reproduce and distribute the Software as part of your own software
|
||||
* (“Your Software”). Facebook reserves all rights not expressly granted to
|
||||
* you in this license agreement.
|
||||
*
|
||||
* THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR
|
||||
* EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @providesModule NavigatorNavigationBarStyles
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
* Copyright (c) 2015, Facebook, Inc. All rights reserved.
|
||||
*
|
||||
* @providesModule ReactNavigatorSceneConfigs
|
||||
* Facebook, Inc. (“Facebook”) owns all right, title and interest, including
|
||||
* all intellectual property and other proprietary rights, in and to the React
|
||||
* Native CustomComponents software (the “Software”). Subject to your
|
||||
* compliance with these terms, you are hereby granted a non-exclusive,
|
||||
* worldwide, royalty-free copyright license to (1) use and copy the Software;
|
||||
* and (2) reproduce and distribute the Software as part of your own software
|
||||
* (“Your Software”). Facebook reserves all rights not expressly granted to
|
||||
* you in this license agreement.
|
||||
*
|
||||
* THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR
|
||||
* EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @providesModule NavigatorSceneConfigs
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
@@ -260,7 +281,7 @@ var BaseConfig = {
|
||||
interpolators: Interpolators.Horizontal,
|
||||
};
|
||||
|
||||
var ReactNavigatorSceneConfigs = {
|
||||
var NavigatorSceneConfigs = {
|
||||
PushFromRight: merge(BaseConfig, {
|
||||
// We will want to customize this soon
|
||||
}),
|
||||
@@ -276,4 +297,4 @@ var ReactNavigatorSceneConfigs = {
|
||||
}),
|
||||
};
|
||||
|
||||
module.exports = ReactNavigatorSceneConfigs;
|
||||
module.exports = NavigatorSceneConfigs;
|
||||
Reference in New Issue
Block a user