Skip to content

Commit 6b0bfef

Browse files
authored
Fix double height increase on ios for text strokes (#144)
* Removes the double height calculation for text stroke on ios * Removes height changes for text stroke on ios
1 parent 0b55ab3 commit 6b0bfef

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

packages/react-native/Libraries/Text/Text/RCTTextShadowView.mm

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -411,22 +411,7 @@ - (CGFloat)lastBaselineForSize:(CGSize)size
411411
}
412412
}];
413413

414-
// Account for stroke width in baseline calculation
415-
__block CGFloat strokeWidth = 0;
416-
[attributedText enumerateAttribute:@"RCTTextStrokeWidth"
417-
inRange:NSMakeRange(0, attributedText.length)
418-
options:0
419-
usingBlock:^(id value, NSRange range, BOOL *stop) {
420-
if (value && [value isKindOfClass:[NSNumber class]]) {
421-
CGFloat width = [value floatValue];
422-
if (width > 0) {
423-
strokeWidth = MAX(strokeWidth, width);
424-
*stop = YES;
425-
}
426-
}
427-
}];
428-
429-
return size.height + maximumDescender + strokeWidth;
414+
return size.height + maximumDescender;
430415
}
431416

432417
static YGSize RCTTextShadowViewMeasure(
@@ -474,7 +459,6 @@ static YGSize RCTTextShadowViewMeasure(
474459

475460
if (strokeWidth > 0) {
476461
size.width += strokeWidth;
477-
size.height += strokeWidth;
478462
}
479463

480464
size = (CGSize){

0 commit comments

Comments
 (0)