Explorar el Código

Fix title.font when subtitle supplied

yogevbd hace 5 años
padre
commit
14a5b748fa
Se han modificado 1 ficheros con 3 adiciones y 7 borrados
  1. 3
    7
      lib/ios/RNNTitleViewHelper.m

+ 3
- 7
lib/ios/RNNTitleViewHelper.m Ver fichero

@@ -127,14 +127,10 @@
127 127
 	
128 128
 	titleLabel.autoresizingMask = self.titleView.autoresizingMask;
129 129
 	
130
-	UIFont *titleFont = [UIFont boldSystemFontOfSize:17.f];
130
+	NSDictionary* fontAttributes = [RNNFontAttributesCreator createFontAttributesWithFontFamily:[_titleOptions.fontFamily getWithDefaultValue:nil] fontSize:[_titleOptions.fontSize getWithDefaultValue:nil] color:[_subtitleOptions.color getWithDefaultValue:nil]];
131
+	[titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:fontAttributes]];
131 132
 	
132
-	CGFloat fontSizeFloat = [RCTConvert CGFloat:[_titleOptions.fontSize getWithDefaultValue:@(17)]];
133
-	titleFont = [UIFont boldSystemFontOfSize:fontSizeFloat];
134
-	
135
-	[titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:_titleOptions.fontAttributes]];
136
-	
137
-	CGSize labelSize = [titleLabel.text sizeWithAttributes:@{NSFontAttributeName:titleFont}];
133
+	CGSize labelSize = [titleLabel.text sizeWithAttributes:fontAttributes];
138 134
 	CGRect labelframe = titleLabel.frame;
139 135
 	labelframe.size = labelSize;
140 136
 	titleLabel.frame = labelframe;