mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-06 21:13:17 +00:00
Added CI workflow and local pre-commit hook for formatting and linting the newly added JS, iOS and Android code.
20 lines
752 B
Plaintext
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
|