React-Native:文本在不同的手机中呈现不同

问题描述

这是我用来渲染文本的样式

 TEXT_B16: {
    fontFamily: 'OpenSans-Bold',fontWeight: fontWeight,fontSize: 16,lineHeight: 22,},

输出如下,

三星

enter image description here

一加

enter image description here

iPhone 12 Pro Max

enter image description here

iPhone 6

enter image description here

尽管样式相同,但不同屏幕的 fontSize 和 fontWeight 是不同的。

这是移动应用中自然发生的事情,还是有什么方法可以在多个设备上实现统一?

(请原谅更大的图像。如果我压缩,则很难识别差异)

谢谢。

解决方法

在您的文本组件中禁用 allowFontScaling

<Text allowFontScaling={false} />