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

相关推荐
studyForMokey1 分钟前
【跨端技术】React Native学习记录一
javascript·学习·react native·react.js
小码过河.4 分钟前
vue-office使用指南
前端·javascript·vue.js
wuhen_n13 分钟前
LeetCode -- 349. 两个数组的交集(简单)
前端·javascript·算法·leetcode
weixin_4624462315 分钟前
Node.js 纯 JS 生成 SVG 练字纸(米字格 / 田字格)完整实现解析
开发语言·javascript·node.js
duanyuehuan24 分钟前
vueRouter重置路由
前端·javascript·vue.js
阿珊和她的猫42 分钟前
页面停留时长埋点实现技术详解
开发语言·前端·javascript·ecmascript
chilavert31844 分钟前
技术演进中的开发沉思-275 AJax : Slider
前端·javascript·ajax·交互
锥锋骚年1 小时前
Vue 3 Vben Admin 框架的Mention提及组件
前端·javascript·vue.js
未来之窗软件服务1 小时前
幽冥大陆(七十一) Whisper-ASR网页对接语音识别—东方仙盟练气期
javascript·whisper·语音识别·仙盟创梦ide·东方仙盟
2501_946230989 小时前
Cordova&OpenHarmony通知中心实现
android·javascript