如何在React Native for IOS应用中禁用字体缩放? [英] How to disable font scaling in React Native for IOS app?

查看:123
本文介绍了如何在React Native for IOS应用中禁用字体缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

放大设备字体的大小有时会中断(明智地设计样式).

Enlargement of size of the device font will sometimes break (Styling wise).

推荐答案

对于React native 0.58 +

For React native 0.58+

最好保持字体缩放,但可以通过使用Text new prop maxFontSizeMultiplier来限制字体缩放

Preferable to keep font scaling but you can limit it by using Text new prop maxFontSizeMultiplier

对于React Native 0.56+,使用李维的答案

For React native 0.56+ use Levi's answer

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

对于React native 0.55及更低版本

For React native 0.55 and lower

在应用程序的开头(例如main.js或app.js等)添加Text.defaultProps.allowFontScaling=false,以将该道具应用于整个应用程序的所有Text组件.

Add Text.defaultProps.allowFontScaling=false at the beginning of the app (e.g. main.js or app.js etc ...) to apply this prop on all Text components through out the whole app.

这篇关于如何在React Native for IOS应用中禁用字体缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆