diff --git a/Libraries/Text/RCTShadowText.m b/Libraries/Text/RCTShadowText.m index eced9cd0c..72461db6e 100644 --- a/Libraries/Text/RCTShadowText.m +++ b/Libraries/Text/RCTShadowText.m @@ -369,6 +369,14 @@ static css_dim_t RCTMeasure(void *context, float width, css_measure_mode_t width } paragraphStyle.minimumLineHeight = lineHeight; paragraphStyle.maximumLineHeight = lineHeight; + + // vertically center text + CGFloat fontSize = _fontSize && !isnan(_fontSize) ? _fontSize : UIFont.systemFontSize; + fontSize *= fontSizeMultiplier; + + [attributedString addAttribute:NSBaselineOffsetAttributeName + value:@(lineHeight/2 - fontSize/2) + range:(NSRange){0, attributedString.length}]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:(NSRange){0, attributedString.length}];