Skip to content

Commit

Permalink
Added support for barTintColor and titleTintColor.
Browse files Browse the repository at this point in the history
  • Loading branch information
blaues0cke committed May 8, 2017
1 parent 8c3ff53 commit 69c94d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions RCTBrowser.m
Expand Up @@ -45,6 +45,23 @@ @implementation RCTBrowser
UIViewController *rootVC = [[UIApplication sharedApplication] keyWindow].rootViewController;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:webVC];

[options enumerateKeysAndObjectsUsingBlock:^(NSString* key, id obj, BOOL *stop) {
if ([key isEqualToString:@"barTintColor"]) {
UIColor *color = [RCTConvert UIColor:obj];

nav.navigationBar.barTintColor = color;
nav.toolbar.barTintColor = color;
} else if ([key isEqualToString:@"titleTintColor"]) {
UIColor *color = [RCTConvert UIColor:obj];

nav.navigationBar.tintColor = color;
nav.toolbar.tintColor = color;

[nav.navigationBar setTitleTextAttributes:
@{NSForegroundColorAttributeName:color}];
}
}];

dispatch_async(dispatch_get_main_queue(), ^{
[rootVC presentViewController:nav animated:YES completion: nil];
});
Expand Down
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -40,7 +40,9 @@ Browser.open('https://google.com/', {
showPageTitles: true,
disableContextualPopupMenu: false,
hideWebViewBoundaries: false,
buttonTintColor: processColor('#d64bbd')
buttonTintColor: processColor('#d64bbd'),
titleTintColor: processColor('#d64bbd'),
barTintColor: processColor('#d64bbd')
});
```

Expand Down

0 comments on commit 69c94d5

Please sign in to comment.