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
 		[barButtonItem setImage:[barButtonItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
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
 	NSNumber* disabledColor = dictionary[@"disabledColor"];
107
 	NSNumber* disabledColor = dictionary[@"disabledColor"];
105
 	if (disabledColor) {
108
 	if (disabledColor) {
106
 		UIColor *color = [RCTConvert UIColor:disabledColor];
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
 	NSString *testID = dictionary[@"testID"];
124
 	NSString *testID = dictionary[@"testID"];
111
 	if (testID)
125
 	if (testID)
112
 	{
126
 	{