React native Text Webview 处理字体大小的变化

If the user has set a custom font size in the Android system, an undesirable scale of the site interface in WebView occurs.
如果用户在Android系统中设置了自定义字体大小,会导致WebView中的站点界面出现不良比例
When setting the standard textZoom (100) parameter size, this undesirable effect disappears.
当设置标准textZoom(100)参数大小时,这种不良效果就消失了。

<WebView
    textZoom={100}
    source={}/>

https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#textzoom

对于 Text 组件上使用 allowFontScaling 属性,

想要在整个应用程序中禁用字体缩放,你可以通过全局设置 defaultProps 中的 allowFontScaling 属性来实现

Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;

Text.defaultProps = Object.assign({}, Text.defaultProps, {
  allowFontScaling: false,
});

https://reactnative.dev/docs/text#allowfontscaling

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值