|
@@ -484,11 +484,95 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
|
484
|
484
|
[viewController setNeedsStatusBarAppearanceUpdate];
|
485
|
485
|
}
|
486
|
486
|
|
487
|
|
- NSNumber *tabBarHidden = self.navigatorStyle[@"tabBarHidden"];
|
488
|
|
- BOOL tabBarHiddenBool = tabBarHidden ? [tabBarHidden boolValue] : NO;
|
489
|
|
- if (tabBarHiddenBool) {
|
|
487
|
+ if (viewController.tabBarController && viewController.tabBarController.tabBar != (id)[NSNull null]) {
|
490
|
488
|
UITabBar *tabBar = viewController.tabBarController.tabBar;
|
491
|
|
- tabBar.transform = CGAffineTransformMakeTranslation(0, tabBar.frame.size.height);
|
|
489
|
+
|
|
490
|
+ if (tabBar && tabBar != (id)[NSNull null]) {
|
|
491
|
+ UIColor *buttonColor = nil;
|
|
492
|
+ UIColor *selectedButtonColor = nil;
|
|
493
|
+ UIColor *labelColor = nil;
|
|
494
|
+ UIColor *selectedLabelColor = nil;
|
|
495
|
+
|
|
496
|
+ NSNumber *tabBarHidden = self.navigatorStyle[@"tabBarHidden"];
|
|
497
|
+ BOOL tabBarHiddenBool = tabBarHidden ? [tabBarHidden boolValue] : NO;
|
|
498
|
+ if (tabBarHiddenBool) {
|
|
499
|
+ tabBar.transform = CGAffineTransformMakeTranslation(0, tabBar.frame.size.height);
|
|
500
|
+ }
|
|
501
|
+
|
|
502
|
+ NSString *tabBarButtonColor = self.navigatorStyle[@"tabBarButtonColor"];
|
|
503
|
+ NSString *tabBarSelectedButtonColor = self.navigatorStyle[@"tabBarSelectedButtonColor"];
|
|
504
|
+
|
|
505
|
+ if (tabBarButtonColor)
|
|
506
|
+ {
|
|
507
|
+ buttonColor = tabBarButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarButtonColor] : nil;
|
|
508
|
+
|
|
509
|
+ if (tabBarSelectedButtonColor) {
|
|
510
|
+ selectedButtonColor = tabBarSelectedButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarSelectedButtonColor] : nil;
|
|
511
|
+
|
|
512
|
+ tabBar.tintColor = selectedLabelColor = selectedButtonColor;
|
|
513
|
+ tabBar.unselectedItemTintColor = labelColor = buttonColor;
|
|
514
|
+ }
|
|
515
|
+ else {
|
|
516
|
+ tabBar.tintColor = labelColor = buttonColor;
|
|
517
|
+ }
|
|
518
|
+ }
|
|
519
|
+ else if (tabBarSelectedButtonColor) {
|
|
520
|
+ selectedButtonColor = tabBarSelectedButtonColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarSelectedButtonColor] : nil;
|
|
521
|
+ tabBar.tintColor = selectedLabelColor = selectedButtonColor;
|
|
522
|
+ }
|
|
523
|
+
|
|
524
|
+ NSString *tabBarLabelColor = self.navigatorStyle[@"tabBarLabelColor"];
|
|
525
|
+ if(tabBarLabelColor) {
|
|
526
|
+ UIColor *color = tabBarLabelColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarLabelColor] : nil;
|
|
527
|
+ labelColor = color;
|
|
528
|
+ }
|
|
529
|
+ NSString *tabBarSelectedLabelColor = self.navigatorStyle[@"tabBarSelectedLabelColor"];
|
|
530
|
+ if(tabBarLabelColor) {
|
|
531
|
+ UIColor *color = tabBarSelectedLabelColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarSelectedLabelColor] : nil;
|
|
532
|
+ selectedLabelColor = color;
|
|
533
|
+ }
|
|
534
|
+
|
|
535
|
+ NSString *tabBarBackgroundColor = self.navigatorStyle[@"tabBarBackgroundColor"];
|
|
536
|
+ if (tabBarBackgroundColor)
|
|
537
|
+ {
|
|
538
|
+ UIColor *color = tabBarBackgroundColor != (id)[NSNull null] ? [RCTConvert UIColor:tabBarBackgroundColor] : nil;
|
|
539
|
+ tabBar.barTintColor = color;
|
|
540
|
+ }
|
|
541
|
+
|
|
542
|
+ NSNumber *tabBarTranslucent = self.navigatorStyle[@"tabBarTranslucent"];
|
|
543
|
+ if (tabBarTranslucent)
|
|
544
|
+ {
|
|
545
|
+ BOOL tabBarTranslucentBool = tabBarTranslucent ? [tabBarTranslucent boolValue] : NO;
|
|
546
|
+ tabBar.translucent = tabBarTranslucentBool;
|
|
547
|
+ }
|
|
548
|
+
|
|
549
|
+ NSNumber *tabBarHideShadow = self.navigatorStyle[@"tabBarHideShadow"];
|
|
550
|
+ if (tabBarHideShadow)
|
|
551
|
+ {
|
|
552
|
+ BOOL tabBarHideShadowBool = tabBarHideShadow ? [tabBarHideShadow boolValue] : NO;
|
|
553
|
+ tabBar.clipsToBounds = tabBarHideShadowBool ? YES : NO;
|
|
554
|
+ }
|
|
555
|
+
|
|
556
|
+ for (UIViewController *tabViewController in [viewController.tabBarController viewControllers]) {
|
|
557
|
+ NSMutableDictionary *unselectedAttributes = [RCTHelpers textAttributesFromDictionary:self.navigatorStyle withPrefix:@"tabBarText" baseFont:[UIFont systemFontOfSize:10]];
|
|
558
|
+ if (!unselectedAttributes[NSForegroundColorAttributeName] && labelColor) {
|
|
559
|
+ unselectedAttributes[NSForegroundColorAttributeName] = labelColor;
|
|
560
|
+ }
|
|
561
|
+ [tabViewController.tabBarItem setTitleTextAttributes:unselectedAttributes forState:UIControlStateNormal];
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+ NSMutableDictionary *selectedAttributes = [RCTHelpers textAttributesFromDictionary:self.navigatorStyle withPrefix:@"tabBarSelectedText" baseFont:[UIFont systemFontOfSize:10]];
|
|
565
|
+ if (!selectedAttributes[NSForegroundColorAttributeName] && selectedLabelColor) {
|
|
566
|
+ selectedAttributes[NSForegroundColorAttributeName] = selectedLabelColor;
|
|
567
|
+ }
|
|
568
|
+ [tabViewController.tabBarItem setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
|
|
569
|
+
|
|
570
|
+ if (buttonColor)
|
|
571
|
+ {
|
|
572
|
+ tabViewController.tabBarItem.image = [[RCCTabBarController image:tabViewController.tabBarItem.image withColor:buttonColor] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
573
|
+ }
|
|
574
|
+ }
|
|
575
|
+ }
|
492
|
576
|
}
|
493
|
577
|
|
494
|
578
|
NSNumber *navBarHidden = self.navigatorStyle[@"navBarHidden"];
|