From 14a5b748fa461a9c4bd50ca0148a0e13a8ae6fba Mon Sep 17 00:00:00 2001 From: yogevbd Date: Sun, 9 Dec 2018 14:48:38 +0200 Subject: [PATCH] Fix title.font when subtitle supplied --- lib/ios/RNNTitleViewHelper.m | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/ios/RNNTitleViewHelper.m b/lib/ios/RNNTitleViewHelper.m index ccbe8395aaf..33c5833a1d0 100644 --- a/lib/ios/RNNTitleViewHelper.m +++ b/lib/ios/RNNTitleViewHelper.m @@ -127,14 +127,10 @@ -(UILabel*)setupTitle { titleLabel.autoresizingMask = self.titleView.autoresizingMask; - UIFont *titleFont = [UIFont boldSystemFontOfSize:17.f]; + NSDictionary* fontAttributes = [RNNFontAttributesCreator createFontAttributesWithFontFamily:[_titleOptions.fontFamily getWithDefaultValue:nil] fontSize:[_titleOptions.fontSize getWithDefaultValue:nil] color:[_subtitleOptions.color getWithDefaultValue:nil]]; + [titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:fontAttributes]]; - CGFloat fontSizeFloat = [RCTConvert CGFloat:[_titleOptions.fontSize getWithDefaultValue:@(17)]]; - titleFont = [UIFont boldSystemFontOfSize:fontSizeFloat]; - - [titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:_titleOptions.fontAttributes]]; - - CGSize labelSize = [titleLabel.text sizeWithAttributes:@{NSFontAttributeName:titleFont}]; + CGSize labelSize = [titleLabel.text sizeWithAttributes:fontAttributes]; CGRect labelframe = titleLabel.frame; labelframe.size = labelSize; titleLabel.frame = labelframe;