Browse Source

fixes badgeColor in ios 13+ (#6246)

The badge colour was not changing from the default red in the tab bar item (when passing "badgeColor" to "bottomTab" options)
David Adams 4 years ago
parent
commit
28928e567e
No account linked to committer's email address
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      lib/ios/UIViewController+RNNOptions.m

+ 6
- 3
lib/ios/UIViewController+RNNOptions.m View File

@@ -95,9 +95,12 @@ const NSInteger BLUR_STATUS_TAG = 78264801;
95 95
 }
96 96
 
97 97
 - (void)setTabBarItemBadgeColor:(UIColor *)badgeColor {
98
-	if (@available(iOS 10.0, *)) {
99
-		self.tabBarItem.badgeColor = badgeColor;
100
-	}
98
+	if (@available(iOS 13.0, *)) {
99
+        self.tabBarItem.standardAppearance.stackedLayoutAppearance.normal.badgeBackgroundColor = badgeColor;
100
+    }
101
+    else if (@available(iOS 10.0, *)) {
102
+        self.tabBarItem.badgeColor = badgeColor;
103
+    }
101 104
 }
102 105
 
103 106
 - (void)setStatusBarStyle:(NSString *)style animated:(BOOL)animated {