NavigatorIOS navigationBarHidden property support

Summary:
Usage example:
```javascript
var AwesomeProject = React.createClass({
  render: function() {
    return (
      <NavigatorIOS
        style={styles.navigator}
        navigationBarHidden={true}
        initialRoute={{
          component: Example,
          title: 'Test'
        }}
      />
    );
  }
});
```
Closes https://github.com/facebook/react-native/pull/374
Github Author: Kureev Alexey <kureev-mail@ya.ru>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Kureev Alexey 2015-04-09 08:52:25 -07:00
parent 20d95ed129
commit 50309c984d
4 changed files with 13 additions and 1 deletions

View File

@ -50,6 +50,7 @@ var RCTNavigatorItem = createReactIOSNativeComponentClass({
rightButtonTitle: true,
onNavRightButtonTap: true,
tintColor: true,
navigationBarHidden: true,
backButtonTitle: true,
titleTextColor: true,
style: true,
@ -235,6 +236,11 @@ var NavigatorIOS = React.createClass({
}).isRequired,
/**
* A Boolean value that indicates whether the navigation bar is hidden
*/
navigationBarHidden: PropTypes.bool,
/**
* The default wrapper style for components in the navigator.
* A common use case is to set the backgroundColor for every page
@ -547,6 +553,7 @@ var NavigatorIOS = React.createClass({
backButtonTitle={route.backButtonTitle}
rightButtonTitle={route.rightButtonTitle}
onNavRightButtonTap={route.onRightButtonPress}
navigationBarHidden={this.props.navigationBarHidden}
tintColor={this.props.tintColor}>
<Component
navigator={this.navigator}

View File

@ -14,6 +14,7 @@
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *rightButtonTitle;
@property (nonatomic, copy) NSString *backButtonTitle;
@property (nonatomic, assign) BOOL navigationBarHidden;
@property (nonatomic, copy) UIColor *tintColor;
@property (nonatomic, copy) UIColor *barTintColor;
@property (nonatomic, copy) UIColor *titleTextColor;

View File

@ -24,6 +24,7 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_VIEW_PROPERTY(title, NSString)
RCT_EXPORT_VIEW_PROPERTY(rightButtonTitle, NSString);
RCT_EXPORT_VIEW_PROPERTY(backButtonTitle, NSString);
RCT_EXPORT_VIEW_PROPERTY(navigationBarHidden, BOOL);
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor);
RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor);
RCT_EXPORT_VIEW_PROPERTY(titleTextColor, UIColor);

View File

@ -65,7 +65,10 @@
if ([self.parentViewController isKindOfClass:[UINavigationController class]])
{
[self.navigationController setNavigationBarHidden:!_navItem animated:animated];
[self.navigationController
setNavigationBarHidden:_navItem.navigationBarHidden
animated:animated];
if (!_navItem) {
return;
}