[NavigatorIOS] Allow translucent on NavigatorIOS

Summary:
Hi,

I've updated the NavigatorIOS component to allow setting the translucent property.

usage is:
```
            <NavigatorIOS
                translucent={false}
            />
```

This is my first contrib to react-native, so apologies if I've missed something.

Cheers,
Owen
Closes https://github.com/facebook/react-native/pull/1273
Github Author: Owen Kelly <owen@novede.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Owen Kelly 2015-06-26 07:06:51 -07:00
parent 3ec3312c7c
commit 1cca4fb769
5 changed files with 11 additions and 0 deletions

View File

@ -66,6 +66,7 @@ var NavigatorIOSColors = React.createClass({
tintColor="#FFFFFF"
barTintColor="#183E63"
titleTextColor="#FFFFFF"
translucent="true"
/>
);
},

View File

@ -57,6 +57,7 @@ var RCTNavigatorItem = createReactNativeComponentClass({
backButtonIcon: true,
backButtonTitle: true,
tintColor: true,
translucent: true,
navigationBarHidden: true,
titleTextColor: true,
style: true,
@ -300,6 +301,11 @@ var NavigatorIOS = React.createClass({
*/
titleTextColor: PropTypes.string,
/**
* A Boolean value that indicates whether the navigation bar is translucent
*/
translucent: PropTypes.bool,
},
navigator: (undefined: ?Object),
@ -609,6 +615,7 @@ var NavigatorIOS = React.createClass({
navigationBarHidden={this.props.navigationBarHidden}
tintColor={this.props.tintColor}
barTintColor={this.props.barTintColor}
translucent={this.props.translucent}
titleTextColor={this.props.titleTextColor}>
<Component
navigator={this.navigator}

View File

@ -22,6 +22,7 @@
@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, strong) UIColor *barTintColor;
@property (nonatomic, strong) UIColor *titleTextColor;
@property (nonatomic, assign) BOOL translucent;
@property (nonatomic, readonly) UIBarButtonItem *backButtonItem;
@property (nonatomic, readonly) UIBarButtonItem *leftButtonItem;

View File

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

View File

@ -81,6 +81,7 @@ RCT_NOT_IMPLEMENTED(-initWithCoder:(NSCoder *)aDecoder)
UINavigationBar *bar = self.navigationController.navigationBar;
bar.barTintColor = _navItem.barTintColor;
bar.tintColor = _navItem.tintColor;
bar.translucent = _navItem.translucent;
if (_navItem.titleTextColor) {
[bar setTitleTextAttributes:@{NSForegroundColorAttributeName : _navItem.titleTextColor}];
}