|
@@ -35,7 +35,8 @@
|
35
|
35
|
|
36
|
36
|
-(void)setButtons:(NSArray*)buttons side:(NSString*)side animated:(BOOL)animated {
|
37
|
37
|
NSMutableArray *barButtonItems = [NSMutableArray new];
|
38
|
|
- for (NSDictionary *button in buttons) {
|
|
38
|
+ NSArray* resolvedButtons = [self resolveButtons:buttons];
|
|
39
|
+ for (NSDictionary *button in resolvedButtons) {
|
39
|
40
|
RNNUIBarButtonItem* barButtonItem = [self buildButton:button];
|
40
|
41
|
if(barButtonItem) {
|
41
|
42
|
[barButtonItems addObject:barButtonItem];
|
|
@@ -53,6 +54,14 @@
|
53
|
54
|
}
|
54
|
55
|
}
|
55
|
56
|
|
|
57
|
+- (NSArray *)resolveButtons:(id)buttons {
|
|
58
|
+ if ([buttons isKindOfClass:[NSArray class]]) {
|
|
59
|
+ return buttons;
|
|
60
|
+ } else {
|
|
61
|
+ return @[buttons];
|
|
62
|
+ }
|
|
63
|
+}
|
|
64
|
+
|
56
|
65
|
-(RNNUIBarButtonItem*)buildButton: (NSDictionary*)dictionary {
|
57
|
66
|
NSString* buttonId = dictionary[@"id"];
|
58
|
67
|
NSString* title = dictionary[@"title"];
|