|
@@ -1,6 +1,19 @@
|
1
|
1
|
#import "RNNNavigationOptions.h"
|
2
|
2
|
#import <React/RCTConvert.h>
|
3
|
3
|
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+@interface RNNNavigationOptions ()
|
|
7
|
+
|
|
8
|
+@property (nonatomic, strong, readwrite) NSNumber* topBarBackgroundColor;
|
|
9
|
+@property (nonatomic, strong, readwrite) NSNumber* topBarTextColor;
|
|
10
|
+@property (nonatomic, strong, readwrite) NSNumber* statusBarHidden;
|
|
11
|
+@property (nonatomic, strong, readwrite) NSString* title;
|
|
12
|
+@property (nonatomic, strong, readwrite) NSString* setTabBadge;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+@end
|
|
16
|
+
|
4
|
17
|
@implementation RNNNavigationOptions
|
5
|
18
|
|
6
|
19
|
-(instancetype)init {
|
|
@@ -13,6 +26,7 @@
|
13
|
26
|
self.statusBarHidden = [navigationOptions objectForKey:@"statusBarHidden"];
|
14
|
27
|
self.title = [navigationOptions objectForKey:@"title"];
|
15
|
28
|
self.topBarTextColor = [navigationOptions objectForKey:@"topBarTextColor"];
|
|
29
|
+ self.setTabBadge = [navigationOptions objectForKey:@"setTabBadge"];
|
16
|
30
|
}
|
17
|
31
|
return self;
|
18
|
32
|
}
|
|
@@ -35,6 +49,15 @@
|
35
|
49
|
UIColor* textColor = [RCTConvert UIColor:self.topBarTextColor];
|
36
|
50
|
viewController.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:textColor};
|
37
|
51
|
}
|
|
52
|
+ if (self.setTabBadge) {
|
|
53
|
+ NSString *badge = [RCTConvert NSString:self.setTabBadge];
|
|
54
|
+ if (viewController.navigationController) {
|
|
55
|
+ viewController.navigationController.tabBarItem.badgeValue = badge;
|
|
56
|
+ }
|
|
57
|
+ else {
|
|
58
|
+ viewController.tabBarItem.badgeValue = badge;
|
|
59
|
+ }
|
|
60
|
+ }
|
38
|
61
|
}
|
39
|
62
|
|
40
|
63
|
|