当我更改Android设备的字体大小时

发布于 2025-01-24 01:16:59 字数 196 浏览 4 评论 0原文

我在React-Native应用程序中具有此表单,当设备的字体大小不默认时,输入文本的字体大小和选择选项的字体大小看起来不同。

在此处输入图像描述

如何解决此问题?

I have this form in my react-native app and when the font-size of a device is not default, the font-size of an input text and a select option looks different.

enter image description here

How to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潦草背影 2025-01-31 01:16:59

您需要在app.tsx(凝视应用程序文件)文件中写下以下代码。

 useEffect(()=>{
   if (Text.defaultProps == null) Text.defaultProps = {};
   Text.defaultProps.allowFontScaling = false;
 }) 
 

对于上述代码,如果您的设备字体设置更改您的应用程序字体更改将不会更改,则无论您提供的样式提供的内容都将保持不变

You need to write below code in your app.tsx(Your staring application file) File inside useEffect.

 useEffect(()=>{
   if (Text.defaultProps == null) Text.defaultProps = {};
   Text.defaultProps.allowFontScaling = false;
 }) 
 

For above code if your device font setting change your app font change will not change it will remain same whatever you provide in your style

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文