React本机字体大小不匹配Figma模拟

发布于 2025-02-11 20:36:51 字数 337 浏览 2 评论 0原文

我有一个为iPhone 11 Pro设计的Figma模拟,WXH为375x812像素。即使在同一iPhone模型上运行React Native时,我也无法使用React Native的样式属性来匹配FIGMA字体大小。例如,如果我在FIGMA A fontsize中使用14中的14px的字体大小,则在React Native中的14个大小与之匹配。没有明显的缩放因子匹配的因素(例如3倍尺度因子太大)。

如何从FIGMA字体尺寸到React本机字体大小?

编辑:在同一设备上运行的我的应用程序和无花果的屏幕截图表明,在应用程序中, All UI元素(包括文本)比无花果小〜10%。

I have a Figma mock that's designed for iPhone 11 Pro and a WxH of 375x812 pixels. I can't match the Figma font size using React Native's fontSize style property, even when running React Native on the same iPhone model. For example, if I use a font size of 14px in Figma a fontSize of 14 in React Native doesn't match that. There's no obvious scaling factor that matches either (e.g. a 3x scale factor is way too large).

How do I go from a Figma font size to a React Native font size?

Edit: taking a screenshot of my app and Figma, running on the same device, shows that all UI elements (including text) are ~10% smaller in the app than in Figma.

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

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

发布评论

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

评论(1

手长情犹 2025-02-18 20:36:51
import { Dimensions } from 'react-native';

const { width, fontScale } = Dimensions.get("window");

const styles = StyleSheet.create({
    fontSize: idleFontSize / fontScale,
});

Fontscale将根据您的设备获得比例。

import { Dimensions } from 'react-native';

const { width, fontScale } = Dimensions.get("window");

const styles = StyleSheet.create({
    fontSize: idleFontSize / fontScale,
});

fontScale will get scale as per your device.

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