react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[iOS] [Text] allowFontScaling does not adjust the line height correctly

Open negativetwelve opened this issue 11 years ago • 4 comments

Changing allowFontScaling to false disables the font scaling on the font itself, but it does not change the line height which causes interesting layouts to occur (in a bad way).

This line and possibly a few others around it should fix it: https://github.com/facebook/react-native/blob/master/Libraries/Text/RCTShadowText.m#L271

I can make this change if it is confirmed to be a bug and not the desired effect!

negativetwelve avatar Sep 17 '15 00:09 negativetwelve

+1, we're having this same issue & it's destroying our app layout if you change accessibility settings, even though fontScaling is set to false.

aprilzero avatar Oct 06 '15 22:10 aprilzero

Changing line 271 to CGFloat lineHeight = round(_lineHeight * (_allowFontScaling && _fontSizeMultiplier > 0.0 ? self.fontSizeMultiplier : 1.0)); seems to fix it for us, using the same multiplier code for line height as font size is.

aprilzero avatar Oct 06 '15 22:10 aprilzero

+1 also experiencing this

Emibob avatar Oct 12 '15 19:10 Emibob

+1

Line 282 of RCTShadowText.m on my version seems to be a temporary fix.

CGFloat lineHeight = round(_lineHeight * (_allowFontScaling && _fontSizeMultiplier > 0.0 ? self.fontSizeMultiplier : 1.0));

medeeiros avatar Nov 13 '15 12:11 medeeiros