From 5804b437316ffb6beac2a3c94f3837621dafec90 Mon Sep 17 00:00:00 2001 From: liang_tao001 Date: Wed, 24 Dec 2025 16:01:35 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=BF=AE=E6=94=B9react-native-device-i?= =?UTF-8?q?nfo=E5=BA=93=E7=9A=84=E4=BD=BF=E7=94=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liang_tao001 --- en/react-native-device-info.md | 26 ++++++++++++++++++++++++++ zh-cn/react-native-device-info.md | 27 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/en/react-native-device-info.md b/en/react-native-device-info.md index 9d1e4772..a7765194 100644 --- a/en/react-native-device-info.md +++ b/en/react-native-device-info.md @@ -159,6 +159,32 @@ const styles = StyleSheet.create({ export default App; ``` +> [!TIP] if calling the getFontScale interface, the following configuration is required. +``` +1. add a configurationion.json file to the Harmony/AppScope/resources/base/profile folder, with the following content: + +{ + "configuration": { + "fontSizeScale": "followSystem", + "fontSizeMaxScale": "3.2" + } +} + +2.Configure "configuration" in the Harry/AppScope/app.json5 file as follows: "$profile: configuration": +{ + "app": { + "bundleName": "com.example.test", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + + "configuration": "$profile:configuration" + } +} +``` + ## Use Codegen diff --git a/zh-cn/react-native-device-info.md b/zh-cn/react-native-device-info.md index 10014c82..7aacd081 100644 --- a/zh-cn/react-native-device-info.md +++ b/zh-cn/react-native-device-info.md @@ -156,6 +156,33 @@ const styles = StyleSheet.create({ export default App; ``` + +> [!注意事项] 如果调用 getFontScale接口,需要进行以下配置。 +``` +1. harmony/AppScope/resources/base/profile文件夹下面新增configuration.json文件,内容如下: + +{ + "configuration": { + "fontSizeScale": "followSystem", + "fontSizeMaxScale": "3.2" + } +} + +2.在harmony/AppScope/app.json5 文件中配置 "configuration": "$profile:configuration" 如下: +{ + "app": { + "bundleName": "com.example.test", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + + "configuration": "$profile:configuration" + } +} +``` + ## 使用 Codegen -- Gitee