akveo / akveo/react-native-ui-kitten

How do I load dynamic custom mapping for font sizes?

未關閉
#1,618 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
10.7k
分支
962
PR 合併指標
30 天內沒有已合併 PR

描述

## 💬 Question

Hello there, recently I faced an issue due to native font scaling setting on my mobile app.

Screenshot 2022-04-30 at 1 40 07 AM

On the left, it is default font size on iOS simulator.
On the right it is the 'Largest' font setting set by user on their mobile.

Hence, I was thinking of using react-native's `fontScale` to check this setting and then set the font sizes according in a **custom mapping**. This is an example `metro.config.js` that I understood from the docs.

```
const evaConfig = {
evaPackage: '@eva-design/eva',
customMappingPath: './src/constants/evaMapping.json',
};

module.exports = MetroConfig.create(evaConfig, {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
});
```

However, with this approach, I cannot check the fontScale on run time and override the font-size values accordingly. Is there another workaround to this problem?

Thank you!

## UI Kitten and Eva version

```
"@eva-design/eva": "2.1.1",
"@ui-kitten/components": "5.1.2",
"@ui-kitten/eva-icons": "5.1.2",
"@ui-kitten/metro-config": "5.1.2",
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。