Browse Source

Added missing buttons styles

yogevbd 6 years ago
parent
commit
dd76abc06a
1 changed files with 18 additions and 4 deletions
  1. 18
    4
      lib/ios/RNNNavigationButtons.m

+ 18
- 4
lib/ios/RNNNavigationButtons.m View File

@@ -96,17 +96,31 @@
96 96
 		[barButtonItem setImage:[barButtonItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
97 97
 	}
98 98
 	
99
-	id tintColor = dictionary[@"tintColor"];
100
-	if (tintColor) {
101
-		[barButtonItem setTintColor:[RCTConvert UIColor: tintColor]];
99
+	NSMutableDictionary* textAttributes = [[NSMutableDictionary alloc] init];
100
+	NSMutableDictionary* disabledTextAttributes = [[NSMutableDictionary alloc] init];
101
+	
102
+	id color = dictionary[@"color"];
103
+	if (color) {
104
+		[textAttributes setObject:color forKey:NSForegroundColorAttributeName];
102 105
 	}
103 106
 	
104 107
 	NSNumber* disabledColor = dictionary[@"disabledColor"];
105 108
 	if (disabledColor) {
106 109
 		UIColor *color = [RCTConvert UIColor:disabledColor];
107
-		[barButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName : color} forState:UIControlStateDisabled];
110
+		[disabledTextAttributes setObject:color forKey:NSForegroundColorAttributeName];
111
+	}
112
+	
113
+	NSNumber* fontSize = dictionary[@"fontSize"] ? dictionary[@"fontSize"] : @(17);
114
+	NSString* fontFamily = dictionary[@"fontFamily"];
115
+	if (fontFamily) {
116
+		[textAttributes setObject:[UIFont fontWithName:fontFamily size:[fontSize floatValue]] forKey:NSForegroundColorAttributeName];
117
+	} else{
118
+		[textAttributes setObject:[UIFont systemFontOfSize:[fontSize floatValue]] forKey:NSForegroundColorAttributeName];
108 119
 	}
109 120
 	
121
+	[barButtonItem setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
122
+	[barButtonItem setTitleTextAttributes:disabledTextAttributes forState:UIControlStateDisabled];
123
+	
110 124
 	NSString *testID = dictionary[@"testID"];
111 125
 	if (testID)
112 126
 	{