Преглед на файлове

fixed the bug on iOS that a fontFamily option does not effect when button state is disabled or highlighted (#3522)

Masaru Ichikawa преди 6 години
родител
ревизия
84799140fe
променени са 1 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. 7
    3
      lib/ios/RNNNavigationButtons.m

+ 7
- 3
lib/ios/RNNNavigationButtons.m Целия файл

@@ -123,13 +123,17 @@
123 123
 	
124 124
 	NSNumber* fontSize = [self fontSize:dictionary[@"fontSize"] defaultFontSize:_defaultButtonStyle.fontSize];
125 125
 	NSString* fontFamily = [self fontFamily:dictionary[@"fontFamily"] defaultFontFamily:_defaultButtonStyle.fontFamily];
126
+	UIFont *font = nil;
126 127
 	if (fontFamily) {
127
-		[textAttributes setObject:[UIFont fontWithName:fontFamily size:[fontSize floatValue]] forKey:NSFontAttributeName];
128
-	} else{
129
-		[textAttributes setObject:[UIFont systemFontOfSize:[fontSize floatValue]] forKey:NSFontAttributeName];
128
+		font = [UIFont fontWithName:fontFamily size:[fontSize floatValue]];
129
+	} else {
130
+		font = [UIFont systemFontOfSize:[fontSize floatValue]];
130 131
 	}
132
+	[textAttributes setObject:font forKey:NSFontAttributeName];
133
+	[disabledTextAttributes setObject:font forKey:NSFontAttributeName];
131 134
 	
132 135
 	[barButtonItem setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
136
+	[barButtonItem setTitleTextAttributes:textAttributes forState:UIControlStateHighlighted];
133 137
 	[barButtonItem setTitleTextAttributes:disabledTextAttributes forState:UIControlStateDisabled];
134 138
 	
135 139
 	NSString *testID = dictionary[@"testID"];