文档模板:v0.4.2
react-native-safe-area-context
本项目基于 react-native-safe-area-context 开发。
该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:@react-native-ohos/react-native-safe-area-context 版本所属关系如下:
| 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |
|---|---|---|---|---|---|---|---|
| @react-native-ohos/react-native-safe-area-context | ~ 5.6.5(开发中) | Gitcode Releases | 0.82./0.84. | 是 | API12+ | 5.8.0 | master |
| @react-native-ohos/react-native-safe-area-context | 5.6.3-5.6.4 | Gitcode Releases | 0.82./0.84. | 否 | API12+ | 5.6.2 | master |
| @react-native-ohos/react-native-safe-area-context | ~ 5.1.1 | Gitcode Releases | 0.77.* | 否 | API12+ | 5.1.0 | br_rnoh0.77 |
| @react-native-ohos/react-native-safe-area-context | ~ 4.7.5 | Gitcode Releases | 0.72.* | 是 | API12+ | 4.7.4 | br_rnoh0.72 |
| @react-native-oh-tpl/react-native-safe-area-context | <= 4.7.4-0.2.1@deprecated | Github Releases(deprecated) | 0.72.* | 否 | API12+ | 4.7.4 | sig |
简介
react-native-safe-area-context 是一个提供安全区域上下文的 React Native 库。
它允许开发者获取设备安全区域的 insets(插入值)和 frame(帧信息),以便正确处理刘海屏、圆角、状态栏等区域的内容布局。该库提供了 SafeAreaProvider、SafeAreaView 组件以及多个 Hooks,使应用能够自适应不同设备的屏幕安全区域。
下载安装
进入到工程目录并输入以下命令:
npm
npm install @react-native-ohos/react-native-safe-area-context
yarn
yarn add @react-native-ohos/react-native-safe-area-context