Files
react-native-svg/apple/Text/RNSVGTopAlignedLabel.ios.mm
Wojciech Lewicki 98c14b4f45 chore: add CI for JS, iOS and Android formatting (#1782)
Added CI workflow and local pre-commit hook for formatting and linting the newly added JS, iOS and Android code.
2022-08-16 12:00:32 +02:00

20 lines
752 B
Plaintext

#import "RNSVGTopAlignedLabel.h"
@implementation RNSVGTopAlignedLabel
- (void)drawTextInRect:(CGRect)rect
{
NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:self.text
attributes:@{NSFontAttributeName : self.font}];
rect.size.height = [attributedText boundingRectWithSize:rect.size
options:NSStringDrawingUsesLineFragmentOrigin
context:nil]
.size.height;
if (self.numberOfLines != 0) {
rect.size.height = MIN(rect.size.height, self.numberOfLines * self.font.lineHeight);
}
[super drawTextInRect:rect];
}
@end