Procházet zdrojové kódy

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

Masaru Ichikawa před 6 roky
rodič
revize
84799140fe
1 změnil soubory, kde provedl 7 přidání a 3 odebrání
  1. 7
    3
      lib/ios/RNNNavigationButtons.m

+ 7
- 3
lib/ios/RNNNavigationButtons.m Zobrazit soubor

123
 	
123
 	
124
 	NSNumber* fontSize = [self fontSize:dictionary[@"fontSize"] defaultFontSize:_defaultButtonStyle.fontSize];
124
 	NSNumber* fontSize = [self fontSize:dictionary[@"fontSize"] defaultFontSize:_defaultButtonStyle.fontSize];
125
 	NSString* fontFamily = [self fontFamily:dictionary[@"fontFamily"] defaultFontFamily:_defaultButtonStyle.fontFamily];
125
 	NSString* fontFamily = [self fontFamily:dictionary[@"fontFamily"] defaultFontFamily:_defaultButtonStyle.fontFamily];
126
+	UIFont *font = nil;
126
 	if (fontFamily) {
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
 	[barButtonItem setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
135
 	[barButtonItem setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
136
+	[barButtonItem setTitleTextAttributes:textAttributes forState:UIControlStateHighlighted];
133
 	[barButtonItem setTitleTextAttributes:disabledTextAttributes forState:UIControlStateDisabled];
137
 	[barButtonItem setTitleTextAttributes:disabledTextAttributes forState:UIControlStateDisabled];
134
 	
138
 	
135
 	NSString *testID = dictionary[@"testID"];
139
 	NSString *testID = dictionary[@"testID"];