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)参数大小时,这种不良效果就消失了。

js 复制代码
<WebView
    textZoom={100}
    source={}/>

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

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

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

bash 复制代码
Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.allowFontScaling = false;

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

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

相关推荐
全栈项目管理程序猿31 分钟前
ArcGIS JS 基础教程(35):体元系列 - VoxelLayer 时间维度动画
前端·javascript
小poop3 小时前
从“雷峰塔”到“对象”:JavaScript基础语法入门指南
前端·javascript
chunyublog3 小时前
HDFS 上传文件名空格问题排障教程
前端·javascript·npm
FRing035 小时前
JavaScript入门到精通二十九(内置构造函数(Object、Array))
开发语言·前端·javascript
天才熊猫君5 小时前
前端队列,我是怎么从 `push + shift` 换成游标的
前端·javascript
Qinging5 小时前
var_let_const
javascript
2501_948122635 小时前
Qs 跨端三方库仓颉适配全流程
python·react native·django·tornado
Maxkim5 小时前
私钥就是数字 4:扒一扒这场把一家 CA 直接送走的事故
javascript·架构
u0111026755 小时前
Canvas 导出 PNG 时 quality 参数为什么不起作用
前端·javascript·vue.js
2601_949847755 小时前
jose 跨端三方库仓颉适配全流程
前端·javascript·flutter