Browse Source

Fix title.font when subtitle supplied

yogevbd 6 years ago
parent
commit
14a5b748fa
1 changed files with 3 additions and 7 deletions
  1. 3
    7
      lib/ios/RNNTitleViewHelper.m

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

127
 	
127
 	
128
 	titleLabel.autoresizingMask = self.titleView.autoresizingMask;
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
 	CGRect labelframe = titleLabel.frame;
134
 	CGRect labelframe = titleLabel.frame;
139
 	labelframe.size = labelSize;
135
 	labelframe.size = labelSize;
140
 	titleLabel.frame = labelframe;
136
 	titleLabel.frame = labelframe;