diff --git a/Examples/UIExplorer/NavigatorIOSColorsExample.js b/Examples/UIExplorer/NavigatorIOSColorsExample.js new file mode 100644 index 00000000000000..e8cf6fac87738a --- /dev/null +++ b/Examples/UIExplorer/NavigatorIOSColorsExample.js @@ -0,0 +1,88 @@ +/** + * The examples provided by Facebook are for non-commercial testing and + * evaluation purposes only. + * + * Facebook reserves all rights not expressly granted. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL + * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +'use strict'; + +var React = require('react-native'); +var { + NavigatorIOS, + StatusBarIOS, + StyleSheet, + Text, + View +} = React; + +var EmptyPage = React.createClass({ + + render: function() { + return ( + + + {this.props.text} + + + ); + }, + +}); + +var NavigatorIOSColors = React.createClass({ + + statics: { + title: ' - Custom', + description: 'iOS navigation with custom nav bar colors', + }, + + render: function() { + // Set StatusBar with light contents to get better contrast + StatusBarIOS.setStyle(StatusBarIOS.Style['lightContent']); + + return ( + ', + rightButtonTitle: 'Done', + onRightButtonPress: () => { + StatusBarIOS.setStyle(StatusBarIOS.Style['default']); + this.props.onExampleExit(); + }, + passProps: { + text: 'The nav bar has custom colors with tintColor,' + + 'barTintColor and titleTextColor props.', + }, + }} + tintColor='#FFFFFF' + barTintColor='#183E63' + titleTextColor='#FFFFFF' + /> + ); + }, + +}); + +var styles = StyleSheet.create({ + container: { + flex: 1, + }, + emptyPage: { + flex: 1, + paddingTop: 64, + }, + emptyPageText: { + margin: 10, + }, +}); + +module.exports = NavigatorIOSColors; diff --git a/Examples/UIExplorer/UIExplorerList.js b/Examples/UIExplorer/UIExplorerList.js index cee61af873a74e..02505a3f81212e 100644 --- a/Examples/UIExplorer/UIExplorerList.js +++ b/Examples/UIExplorer/UIExplorerList.js @@ -27,6 +27,7 @@ var { View, } = React; var NavigatorExample = require('./Navigator/NavigatorExample'); +var NavigatorIOSColorsExample = require('./NavigatorIOSColorsExample'); var { TestModule } = React.addons; @@ -40,6 +41,7 @@ var COMPONENTS = [ require('./ListViewPagingExample'), require('./MapViewExample'), require('./NavigatorIOSExample'), + NavigatorIOSColorsExample, NavigatorExample, require('./PickerIOSExample'), require('./ScrollViewExample'), @@ -187,6 +189,12 @@ class UIExplorerList extends React.Component { ); return; } + if (example === NavigatorIOSColorsExample) { + this.props.onExternalExampleRequested( + NavigatorIOSColorsExample + ); + return; + } var Component = makeRenderable(example); this.props.navigator.push({ title: Component.title, diff --git a/Libraries/Components/Navigation/NavigatorIOS.ios.js b/Libraries/Components/Navigation/NavigatorIOS.ios.js index aa5039edbfdb9c..95997d18eedaaa 100644 --- a/Libraries/Components/Navigation/NavigatorIOS.ios.js +++ b/Libraries/Components/Navigation/NavigatorIOS.ios.js @@ -246,6 +246,16 @@ var NavigatorIOS = React.createClass({ */ tintColor: PropTypes.string, + /** + * The background color of the navigation bar + */ + barTintColor: PropTypes.string, + + /** + * The text color of the navigation bar title + */ + titleTextColor: PropTypes.string, + }, navigator: (undefined: ?Object), @@ -547,7 +557,9 @@ var NavigatorIOS = React.createClass({ backButtonTitle={route.backButtonTitle} rightButtonTitle={route.rightButtonTitle} onNavRightButtonTap={route.onRightButtonPress} - tintColor={this.props.tintColor}> + tintColor={this.props.tintColor} + barTintColor={this.props.barTintColor} + titleTextColor={this.props.titleTextColor}>