diff --git a/Examples/UIExplorer/Navigator/BreadcrumbNavSample.js b/Examples/UIExplorer/Navigator/BreadcrumbNavSample.js index 50e3c66ee..0734dff41 100644 --- a/Examples/UIExplorer/Navigator/BreadcrumbNavSample.js +++ b/Examples/UIExplorer/Navigator/BreadcrumbNavSample.js @@ -1,20 +1,23 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * @providesModule BreadcrumbNavSample + * 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. */ 'use strict'; -var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar'); -var Navigator = require('Navigator'); -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var ScrollView = require('ScrollView'); -var TabBarItemIOS = require('TabBarItemIOS'); -var TabBarIOS = require('TabBarIOS'); -var Text = require('Text'); -var TouchableBounce = require('TouchableBounce'); -var View = require('View'); +var React = require('react-native'); +var { + Navigator, + ScrollView, + StyleSheet, + TabBarIOS, + Text, + View, + TouchableHighlight, +} = React; var SAMPLE_TEXT = 'Top Pushes. Middle Replaces. Bottom Pops.'; @@ -43,28 +46,28 @@ var SampleNavigationBarRouteMapper = { }, titleContentForRoute: function(route, navigator) { return ( - navigator.push(_getRandomRoute())}> {route.title} - + ); }, iconForRoute: function(route, navigator) { var onPress = navigator.popToRoute.bind(navigator, route); return ( - + - + ); }, separatorForRoute: function(route, navigator) { return ( - + - + ); } }; @@ -76,49 +79,49 @@ var renderScene = function(route, navigator) { return ( - request push soon - - + {content} - - + {content} - - + {content} - - + {content} - - + {content} - - + request pop soon - - + Immediate set two routes - - + pop to top soon - + ); @@ -180,10 +183,10 @@ var BreadcrumbNavSample = React.createClass({ }; return ( - } /> - - + Navigator.SceneConfigs.FloatFromBottom} @@ -209,12 +212,12 @@ var BreadcrumbNavSample = React.createClass({ initialRoute={initialRoute} renderScene={renderScene} navigationBar={ - } /> - + ); }, diff --git a/Examples/UIExplorer/Navigator/JumpingNavSample.js b/Examples/UIExplorer/Navigator/JumpingNavSample.js index de115eb54..fa3d72b0d 100644 --- a/Examples/UIExplorer/Navigator/JumpingNavSample.js +++ b/Examples/UIExplorer/Navigator/JumpingNavSample.js @@ -1,17 +1,22 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * @providesModule JumpingNavSample + * 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. */ 'use strict'; -var Navigator = require('Navigator'); -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var ScrollView = require('ScrollView'); -var Text = require('Text'); -var TouchableBounce = require('TouchableBounce'); -var View = require('View'); +var React = require('react-native'); +var { + Navigator, + StyleSheet, + ScrollView, + Text, + TouchableHighlight, + View, +} = React; var _getRandomRoute = function() { return { @@ -32,55 +37,55 @@ var renderScene = function(route, navigator) { {route.randNumber} - { navigator.jumpBack(); }}> jumpBack - - + { navigator.jumpForward(); }}> jumpForward - - + { navigator.jumpTo(INIT_ROUTE); }}> jumpTo initial route - - + { navigator.push(_getRandomRoute()); }}> destructive: push - - + { navigator.replace(_getRandomRoute()); }}> destructive: replace - - + { navigator.pop(); }}> destructive: pop - - + { navigator.immediatelyResetRouteStack([ _getRandomRoute(), @@ -90,15 +95,15 @@ var renderScene = function(route, navigator) { destructive: Immediate set two routes - - + { navigator.popToTop(); }}> destructive: pop to top - + ); @@ -109,7 +114,7 @@ class JumpingNavBar extends React.Component { return ( {this.props.routeStack.map((route, index) => ( - { + { this.props.navigator.jumpTo(route); }}> @@ -121,7 +126,7 @@ class JumpingNavBar extends React.Component { {index} - + ))} ); diff --git a/Examples/UIExplorer/Navigator/NavigationBarSample.js b/Examples/UIExplorer/Navigator/NavigationBarSample.js index 5ebbdc8bb..cba58aabc 100644 --- a/Examples/UIExplorer/Navigator/NavigationBarSample.js +++ b/Examples/UIExplorer/Navigator/NavigationBarSample.js @@ -1,17 +1,22 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * @providesModule NavigationBarSample + * 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. */ 'use strict'; -var Navigator = require('Navigator'); -var NavigationBar = require('NavigationBar'); -var React = require('React'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var TouchableOpacity = require('TouchableOpacity'); -var View = require('View'); + +var React = require('react-native'); +var { + Navigator, + StyleSheet, + Text, + TouchableHighlight, + View, +} = React; var cssVar = require('cssVar'); @@ -25,26 +30,26 @@ var NavigationBarRouteMapper = { var previousRoute = navState.routeStack[index - 1]; return ( - navigator.pop()}> + navigator.pop()}> {previousRoute.title} - + ); }, RightButton: function(route, navigator, index, navState) { return ( - navigator.push(newRandomRoute())}> Next - + ); }, @@ -80,7 +85,7 @@ var NavigationBarSample = React.createClass({ )} navigationBar={ - } diff --git a/Examples/UIExplorer/Navigator/NavigatorExample.js b/Examples/UIExplorer/Navigator/NavigatorExample.js index 204661eeb..f0cae637d 100644 --- a/Examples/UIExplorer/Navigator/NavigatorExample.js +++ b/Examples/UIExplorer/Navigator/NavigatorExample.js @@ -1,14 +1,21 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-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. */ 'use strict'; -var React = require('React'); -var Navigator = require('Navigator'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var ScrollView = require('ScrollView'); -var TouchableHighlight = require('TouchableHighlight'); +var React = require('react-native'); +var { + Navigator, + ScrollView, + StyleSheet, + Text, + TouchableHighlight, +} = React; var BreadcrumbNavSample = require('./BreadcrumbNavSample'); var NavigationBarSample = require('./NavigationBarSample'); var JumpingNavSample = require('./JumpingNavSample'); diff --git a/Examples/UIExplorer/Navigator/NestedBreadcrumbNavSample.js b/Examples/UIExplorer/Navigator/NestedBreadcrumbNavSample.js deleted file mode 100644 index 37ad1a48d..000000000 --- a/Examples/UIExplorer/Navigator/NestedBreadcrumbNavSample.js +++ /dev/null @@ -1,211 +0,0 @@ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule NestedBreadcrumbNavSample - */ -'use strict'; - -var BreadcrumbNavigationBar = require('BreadcrumbNavigationBar'); -var Navigator = require('Navigator'); -var React = require('React'); -var ScrollView = require('ScrollView'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var TouchableBounce = require('TouchableBounce'); -var View = require('View'); - -var SAMPLE_TEXT = 'Top Pushes. Middle Replaces. Bottom Pops.'; - -var _getRandomRoute = function() { - return { - backButtonTitle: 'Back' + ('' + 10 * Math.random()).substr(0, 1), - content: - SAMPLE_TEXT + '\nHere\'s a random number ' + Math.random(), - title: 'Pushed!', - rightButtonTitle: Math.random() > 0.5 ? 'Right' : 'Button', - }; -}; - - -var HorizontalNavigationBarRouteMapper = { - rightContentForRoute: function(route, navigator) { - if (route.rightButtonTitle) { - return ( - - {route.rightButtonTitle} - - ); - } else { - return null; - } - }, - titleContentForRoute: function(route, navigator) { - return ( - () => { navigator.push(_getRandomRoute()); }}> - - {route.title} - - - ); - }, - iconForRoute: function(route, navigator) { - var onPress = - navigator.popToRoute.bind(navigator, route); - return ( - - - - ); - }, - separatorForRoute: function(route, navigator) { - return ( - - - - ); - } -}; - -var ThirdDeepRouteMapper = (route, navigator) => ( - - - - { navigator.push(_getRandomRoute()); }}> - - request push soon - - - - - -); - -var SecondDeepRouteMapper = (route, navigator) => ( - - { navigator.push(_getRandomRoute()); }}> - - Push Horizontal - - - - } - /> - -); - -var FirstDeepRouteMapper = (route, navigator) => ( - - { navigator.push(_getRandomRoute()); }}> - - Push Outer Vertical Stack - - - - } - /> - -); - -/** - * The outer component. - */ -var NestedBreadcrumbNavSample = React.createClass({ - render: function() { - var initialRoute = {title: 'Vertical'}; - // No navigation bar. - return ( - Navigator.SceneConfigs.FloatFromBottom} - initialRoute={initialRoute} - renderScene={FirstDeepRouteMapper} - /> - ); - } -}); - -var styles = StyleSheet.create({ - navigationItem: { - backgroundColor: '#eeeeee', - shadowColor: 'black', - shadowRadius: 20, - shadowOffset: {w: 0, h: -10}, - }, - paddingForNavBar: { - paddingTop: 60, - }, - paddingForMenuBar: { - paddingTop: 10, - }, - button: { - backgroundColor: '#888888', - margin: 10, - marginTop: 10, - padding: 10, - marginRight: 20, - }, - buttonText: { - fontSize: 12, - textAlign: 'center', - color: 'white', - }, - appContainer: { - overflow: 'hidden', - backgroundColor: '#dddddd', - flex: 1, - }, - titleText: { - fontSize: 18, - color: '#666666', - textAlign: 'center', - fontWeight: '500', - lineHeight: 32, - }, - filterText: { - color: '#5577ff', - }, - // TODO: Accept icons from route. - crumbIconPlaceholder: { - flex: 1, - backgroundColor: '#666666', - }, - crumbSeparatorPlaceholder: { - flex: 1, - backgroundColor: '#aaaaaa', - }, - secondDeepNavigator: { - margin: 0, - borderColor: '#666666', - borderWidth: 0.5, - height: 400, - }, - thirdDeepNavigator: { - margin: 0, - borderColor: '#aaaaaa', - borderWidth: 0.5, - height: 400, - }, - thirdDeepScrollContent: { - height: 1000, - } -}); - -module.exports = NestedBreadcrumbNavSample; diff --git a/Examples/UIExplorer/ResponderExample.js b/Examples/UIExplorer/ResponderExample.js index 73398ed1b..529e9f5b6 100644 --- a/Examples/UIExplorer/ResponderExample.js +++ b/Examples/UIExplorer/ResponderExample.js @@ -1,5 +1,11 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-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. + * * @flow */ 'use strict'; diff --git a/Examples/UIExplorer/TabBarExample.js b/Examples/UIExplorer/TabBarExample.js index 793bfd309..f5d07d68f 100644 --- a/Examples/UIExplorer/TabBarExample.js +++ b/Examples/UIExplorer/TabBarExample.js @@ -10,14 +10,14 @@ */ 'use strict'; -var React = require('React'); -var TabBarIOS = require('TabBarIOS'); -var TabBarItemIOS = require('TabBarItemIOS'); -var StyleSheet = require('StyleSheet'); -var Text = require('Text'); -var View = require('View'); - - +var React = require('react-native'); +var { + StyleSheet, + TabBarIOS, + Text, + View, +} = React; +var TabBarItemIOS = TabBarIOS.Item; var TabBarExample = React.createClass({ statics: { diff --git a/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/Contents.json b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/Contents.json new file mode 100644 index 000000000..cf064d8c1 --- /dev/null +++ b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "tabnav_list@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/tabnav_list@3x.png b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/tabnav_list@3x.png new file mode 100644 index 000000000..6cf722790 Binary files /dev/null and b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/tabnav_list@3x.png differ diff --git a/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/Contents.json b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/Contents.json new file mode 100644 index 000000000..eb75c050f --- /dev/null +++ b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "tabnav_notification@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/tabnav_notification@3x.png b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/tabnav_notification@3x.png new file mode 100644 index 000000000..1f65e6590 Binary files /dev/null and b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/tabnav_notification@3x.png differ diff --git a/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/Contents.json b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/Contents.json new file mode 100644 index 000000000..c665c5a07 --- /dev/null +++ b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "tabnav_settings@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/tabnav_settings@3x.png b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/tabnav_settings@3x.png new file mode 100644 index 000000000..581f2c72a Binary files /dev/null and b/Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/tabnav_settings@3x.png differ diff --git a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js index fa82dd4cb..e508268c5 100644 --- a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js +++ b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js @@ -13,11 +13,15 @@ var React = require('React'); var ReactIOSViewAttributes = require('ReactIOSViewAttributes'); +var TabBarItemIOS = require('TabBarItemIOS'); var StyleSheet = require('StyleSheet'); var createReactIOSNativeComponentClass = require('createReactIOSNativeComponentClass'); var TabBarIOS = React.createClass({ + statics: { + Item: TabBarItemIOS, + }, render: function() { return ( diff --git a/Libraries/CustomComponents/Navigator/Navigator.js b/Libraries/CustomComponents/Navigator/Navigator.js index ff74f40c1..ca57bea9c 100644 --- a/Libraries/CustomComponents/Navigator/Navigator.js +++ b/Libraries/CustomComponents/Navigator/Navigator.js @@ -1,16 +1,38 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * 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 Navigator */ - -"use strict" +'use strict'; var AnimationsDebugModule = require('NativeModules').AnimationsDebugModule; var Backstack = require('Backstack'); var Dimensions = require('Dimensions'); var InteractionMixin = require('InteractionMixin'); 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'); @@ -102,6 +124,8 @@ var Navigator = React.createClass({ }, statics: { + BreadcrumbNavigationBar: NavigatorBreadcrumbNavigationBar, + NavigationBar: NavigatorNavigationBar, SceneConfigs: NavigatorSceneConfigs, }, diff --git a/Libraries/CustomComponents/Navigator/BreadcrumbNavigationBar.js b/Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBar.js similarity index 89% rename from Libraries/CustomComponents/Navigator/BreadcrumbNavigationBar.js rename to Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBar.js index 3f16e44cd..3a20e0533 100644 --- a/Libraries/CustomComponents/Navigator/BreadcrumbNavigationBar.js +++ b/Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBar.js @@ -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; diff --git a/Libraries/CustomComponents/Navigator/BreadcrumbNavigationBarStyles.ios.js b/Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBarStyles.ios.js similarity index 73% rename from Libraries/CustomComponents/Navigator/BreadcrumbNavigationBarStyles.ios.js rename to Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBarStyles.ios.js index c71772c23..7bc78ee92 100644 --- a/Libraries/CustomComponents/Navigator/BreadcrumbNavigationBarStyles.ios.js +++ b/Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBarStyles.ios.js @@ -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; diff --git a/Libraries/CustomComponents/Navigator/NavigationBar.js b/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js similarity index 63% rename from Libraries/CustomComponents/Navigator/NavigationBar.js rename to Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js index e1e27b3df..4e6c7c330 100644 --- a/Libraries/CustomComponents/Navigator/NavigationBar.js +++ b/Libraries/CustomComponents/Navigator/NavigatorNavigationBar.js @@ -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 (