From 5b8aad5fdc9f98f9b5d95b2bcb4c736fcb1eef22 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Thu, 26 Mar 2015 00:41:30 -0700 Subject: [PATCH] [ReactNative] License headers and renaming --- .../Navigator/BreadcrumbNavSample.js | 91 ++++---- .../UIExplorer/Navigator/JumpingNavSample.js | 59 ++--- .../Navigator/NavigationBarSample.js | 33 +-- .../UIExplorer/Navigator/NavigatorExample.js | 21 +- .../Navigator/NestedBreadcrumbNavSample.js | 211 ------------------ Examples/UIExplorer/ResponderExample.js | 8 +- Examples/UIExplorer/TabBarExample.js | 16 +- .../tabnav_list.imageset/Contents.json | 21 ++ .../tabnav_list.imageset/tabnav_list@3x.png | Bin 0 -> 360 bytes .../Contents.json | 21 ++ .../tabnav_notification@3x.png | Bin 0 -> 1602 bytes .../tabnav_settings.imageset/Contents.json | 21 ++ .../tabnav_settings@3x.png | Bin 0 -> 1059 bytes .../Components/TabBarIOS/TabBarIOS.ios.js | 4 + .../CustomComponents/Navigator/Navigator.js | 30 ++- ...js => NavigatorBreadcrumbNavigationBar.js} | 27 ++- ...gatorBreadcrumbNavigationBarStyles.ios.js} | 33 ++- ...gationBar.js => NavigatorNavigationBar.js} | 53 +++-- ...ios.js => NavigatorNavigationBarStyles.js} | 25 ++- .../Navigator/NavigatorSceneConfigs.js | 23 +- 20 files changed, 347 insertions(+), 350 deletions(-) delete mode 100644 Examples/UIExplorer/Navigator/NestedBreadcrumbNavSample.js create mode 100644 Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/Contents.json create mode 100644 Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_list.imageset/tabnav_list@3x.png create mode 100644 Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/Contents.json create mode 100644 Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_notification.imageset/tabnav_notification@3x.png create mode 100644 Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/Contents.json create mode 100644 Examples/UIExplorer/UIExplorer/Images.xcassets/tabnav_settings.imageset/tabnav_settings@3x.png rename Libraries/CustomComponents/Navigator/{BreadcrumbNavigationBar.js => NavigatorBreadcrumbNavigationBar.js} (89%) rename Libraries/CustomComponents/Navigator/{BreadcrumbNavigationBarStyles.ios.js => NavigatorBreadcrumbNavigationBarStyles.ios.js} (73%) rename Libraries/CustomComponents/Navigator/{NavigationBar.js => NavigatorNavigationBar.js} (63%) rename Libraries/CustomComponents/Navigator/{NavigationBarStyles.ios.js => NavigatorNavigationBarStyles.js} (73%) 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 0000000000000000000000000000000000000000..6cf72279023724a465ff4bbf5142332aeae18b6b GIT binary patch literal 360 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1|&n@ZgvM!f+emICBgY=CFO}lsSE{q>B&W< z#TgEzo}U>Q7==7t978H@y}e_|*JL2lUifZ7+yNJTHN8B)SI-KkNEb@JHqPu35{P-3 z|AXJ*^oOSxKkZu>>a}vx!v+Qc2L?tK0f*15B^Gf{-GAk+Q{H_-Gw6ACgHrbi+fN-! z`fWb_bv@Y-HgOyCve{<+($$%>0`E2C39H}nV%hTY=bE-pQrmTT1O7f=vdhHbxxIR9 z$ONumOk1|H^}bK~-YGmQXnW;`6pHRCwC$oLg)aMHql9Eh0^+mryIx3xO(X1L2}n zZA^@qfa0x!#Oebt#>68gl1L!L2NJnit9XN&wjxTR7$csjsTz^^Vw9AE!6+J_&=y*y zQW{MowAA&Vk|C!D6JTEVYoScNPf>Nv2=kO7i zplg9TU?cDW@B`2V3;@G`2mB430uBOufGt2hFnufv$_Ew#uL8$WfC)W7GjKOBZY&6T z*Mbxo-S~8sWwW5GfkpU={NlU8V?Y}C9B($Ns0%EDc=cF2^-vN7T?V|xRjfATdA9&R0{?R7vL34( zc+#RY_S#L1OAu=q+queota0uZ!Oa}velNu*pc?quP!cP*!nL4T_!#pQxmn}<5^R`9 zx$}o{NFaLJ&KpYV1?IRCG!HoIt3Z3i$C$lRUvjU5?6_(iFq%j@2h>mtnuQ}?|Hbb# zXbkVbGQu>fDMLwvI!}_WpfbU0l^KIvY1m_|1g=pGAK0jQHBLWl^l)Xi1+m`hfaHQ3 zi04FW2!;Wy;V!f(s9AEMZ-7gQ1+5~QrnK4;^nm07hk?t9<%|c`63*r7Oa&EV7bz;d zhFH#RzzIS*9=2&kCW2m*6nunO&hcou~bv|XdXXDkRxiX28u7(qH+>?XyH zS7MvOa$j!)-(tvtwO<{;6L{P}f&_I137QsRBsxhVC>?Mv3%AY&K1`4xk55jD1l30< zut6YaV#p}qbHL*X6I8Dfv?)S?Ck29*YlIy(Crr?0m7q@|6gVUh)RwTD)*-DD)E=S0 z-vxpWXR)AzDnU`Qn=F7o!6)cV-!UxUJ`=O4Ung8puS!tV5W{D_xHMbhat439h;p*! z>H140Xw;zKpL|mf7B1Ne+{gWGVV1mRQb89iWDM@d48=6xYggqk2xh{tO3aTZ!v|SX#LggK(MQLLqnD3m7B+3Wo`l(l*$h ztm-m~|D}9El5m1XT4*QHYx<~4&~%57@-YmvuEzX(loU3r?>gWki%G_*K>@Swm>S2Y zETxT1h7X-#B8n|B3EFBY0nlksho&%s?ukjzgO&unY*2^0!U!6VDG*m;hOj5InO~cN zjqQ3|9m3kUZ2{@5K7YrdN*p#glEVV{a~*C_DN)Q88gw$N(}2zI4>F98ogiylfv@m<3dg4#J!Hj^s??qMTM1Q03wBv{S^A zUUwje?JC+U>A9{jUBp@Epe>@7B%5PCY-<_t4hNE!5DNNUaJ^=m>!b@Y3rZ>IQ^GZm zst{r%q7lD4B}F_S_^VYxt&BA`f)=J>2|0Eg6&Wg z?1?C*09U^C3*^spwW01NM{%Rcn)RBAxph&#ZnoPX2yTyle;hhhs3-of9p=Gz?=xIbR^)nhk%qo6!Chut zQ~!TpDec=0-G(Wl75Ms&`7coAKG8KM1?3R)A49UD$}Y}lbpQYW07*qoM6N<$f{TyX A@&Et; literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..581f2c72a769f54d36273600de2511e6ed6db022 GIT binary patch literal 1059 zcmV+;1l;?HP)2^fDIDn>lOjgSbzR1U=O7hr)JZbUqok`ScU^-c1c zY&LCo=5=P;?atu~0Xj2pzHWAB-pp*kvaEoiJb|&h3B&VRHUj=P&3fl0apdgUv6vRH);x|E8Ipq`?^qQa;@EV8^%RdnmlpwYf z!8l_&1+m8dVBq_}ZQz7p9m|4(mIdo)@r+`87RDRXA;>Pr&Kl6mS;tA>Kv2*DmgA|v z7vpi(L6Rgxjy-_qKy#V$O~55!T2M}rX)NDVrv7GZ-z~L9_yofL)>( zC%af*tK-Yda+Vj8BwLQ11>hNwlO)DT4(neal;xJhBj~N74%V7?vIIqJPlHC`7jQ=A zJ!rJS1l^H+lV;~LwiDGko1d>TST<0b18xA}GHrzM|DT8hRXg*#(;bhAf&K$h zz##?2r(!{!gdso<`;)-_1$hOv0XKmcz&C+)t8#qQv@|nUWt@5JZxZ|8R!Y#O zf}#DeCPBjrV&8NMvJ^}o!kPqy6--Mk)q=J)uYhiQO;B31ptRQnEov6DXs)0JyMnef z3)=FUpgeWJ+o>~J)3j$-hA^y&~JjwyE`~AZ+~&&7N;QJzCXykfl9)$hD?p) dGjG9j<3AdogG@(7RlEQI002ovPDHLkV1mYW@@D`5 literal 0 HcmV?d00001 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 (