Browse Source

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

Masaru Ichikawa 6 years ago
parent
commit
84799140fe
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      lib/ios/RNNNavigationButtons.m

+ 7
- 3
lib/ios/RNNNavigationButtons.m View File

@@ -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"];