Merged
docs(文档): 同步双语文档至 RNOH 0.88.1 #4059
changlpAdd on 2 days ago
docs(文档): 同步双语文档至 RNOH 0.88.1 #4059
Merged
Total: 53 files changed+967-536
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ## Project Overview | 3 | ## Project Overview |
| 4 | 4 | ||
| 5 | -React Native for OpenHarmony (RNOH) is a framework that brings the React Native development experience to the HarmonyOS ecosystem. Current version **0.86.1**, aligned with upstream React Native 0.86.3. | 5 | +React Native for OpenHarmony (RNOH) is a framework that brings the React Native development experience to the HarmonyOS ecosystem. Current version **0.88.1**, aligned with upstream React Native 0.88.1. |
| 6 | 6 | ||
| 7 | The project uses a pnpm monorepo structure, consisting of four major parts: JS platform layer, ArkTS/C++ native engine layer, CLI toolchain, and build plugin. | 7 | The project uses a pnpm monorepo structure, consisting of four major parts: JS platform layer, ArkTS/C++ native engine layer, CLI toolchain, and build plugin. |
| 8 | 8 | ||
| @@ -15,14 +15,15 @@ For detailed directory structure, architecture layers, module types, key files, | |||
| 15 | - **BiSheng**: Native C++ compiler | 15 | - **BiSheng**: Native C++ compiler |
| 16 | - **Hermes**: JS engine (V1 variant supported) | 16 | - **Hermes**: JS engine (V1 variant supported) |
| 17 | - **pnpm**: 11.21.0 | 17 | - **pnpm**: 11.21.0 |
| 18 | -- **Node**: >=18 | 18 | +- **Node**: >=20 for RNOH packages; Node.js 22.11+ is required by the RN 0.88 upgrade baseline |
| 19 | -- **React**: 19.2.3 / **React Native**: 0.86.3 | 19 | +- **React**: 19.3.0 / **React Native**: 0.88.1 |
| 20 | 20 | ||
| 21 | ## Rules | 21 | ## Rules |
| 22 | 22 | ||
| 23 | - **Document sync rule**: When documents in the `.agents` directory are updated, `.agents/ARCHITECTURE.md` and `.agents/README.md` must be updated accordingly to keep them consistent. | 23 | - **Document sync rule**: When documents in the `.agents` directory are updated, `.agents/ARCHITECTURE.md` and `.agents/README.md` must be updated accordingly to keep them consistent. |
| 24 | 24 | ||
| 25 | - **Test-case rule (enforced by commitlint `rnoh-tests-required`)**: every `feat` / `fix` / `refactor` / `perf` commit MUST reference its covering tests in the body — a CPTF/E2E case id, a gtest target, a test plan link, or the test repo path. Markers: `test case` / `gtest` / `e2e` / `cptf` / `rnoh_test` / `测试用例`. | 25 | - **Test-case rule (enforced by commitlint `rnoh-tests-required`)**: every `feat` / `fix` / `refactor` / `perf` commit MUST reference its covering tests in the body — a CPTF/E2E case id, a gtest target, a test plan link, or the test repo path. Markers: `test case` / `gtest` / `e2e` / `cptf` / `rnoh_test` / `测试用例`. |
| 26 | + | ||
| 26 | - **C++ unit tests** (host, no device): `packages/tester/harmony/react_native_openharmony/src/main/cpp/tests/` — per-module `rnoh_<module>_test` targets (see the C++ gtest section below). | 27 | - **C++ unit tests** (host, no device): `packages/tester/harmony/react_native_openharmony/src/main/cpp/tests/` — per-module `rnoh_<module>_test` targets (see the C++ gtest section below). |
| 27 | - **E2E / integration cases**: `packages/rnoh_test` (submodule, gitcode `CPF-RN/rnoh_test`, CPTF framework) — new component/behavior coverage goes there; initialize with `git submodule update --init --recursive packages/rnoh_test`. | 28 | - **E2E / integration cases**: `packages/rnoh_test` (submodule, gitcode `CPF-RN/rnoh_test`, CPTF framework) — new component/behavior coverage goes there; initialize with `git submodule update --init --recursive packages/rnoh_test`. |
| 28 | - Example body line: `test case: CPTF-1234` / `gtest: rnoh_scrollview_test` / `测试用例: rnoh_test/app/src/…` | 29 | - Example body line: `test case: CPTF-1234` / `gtest: rnoh_scrollview_test` / `测试用例: rnoh_test/app/src/…` |
| @@ -43,7 +44,7 @@ pnpm harmony:tester | |||
| 43 | 44 | ||
| 44 | # Spec-compliant issue / PR automation (dry-run by default; GITCODE_TOKEN + --yes / GBR_YES=1 to create) | 45 | # Spec-compliant issue / PR automation (dry-run by default; GITCODE_TOKEN + --yes / GBR_YES=1 to create) |
| 45 | node .quality-toolkit/tools/create-issue/create-issue.js --type bug --title "…" \ | 46 | node .quality-toolkit/tools/create-issue/create-issue.js --type bug --title "…" \ |
| 46 | - --severity critical --version 0.86.3 --module component --fields '{"problem":"…",…}' # issue per spec §4 | 47 | + --severity critical --version 0.88.1 --module component --fields '{"problem":"…",…}' # issue per spec §4 |
| 47 | GBR_SCOPE=ScrollView GBR_DESC="fix scroll crash" node .quality-toolkit/tools/generate-branch-pr/generate-branch-pr.js # branch + PR per spec | 48 | GBR_SCOPE=ScrollView GBR_DESC="fix scroll crash" node .quality-toolkit/tools/generate-branch-pr/generate-branch-pr.js # branch + PR per spec |
| 48 | node .quality-toolkit/tools/platform-api/platform-api.js ensure-labels # spec §4.1 label taxonomy | 49 | node .quality-toolkit/tools/platform-api/platform-api.js ensure-labels # spec §4.1 label taxonomy |
| 49 | 50 | ||
| @@ -34,7 +34,7 @@ | |||
| 34 | 34 | ||
| 35 | ### 📦 版本管理 | 35 | ### 📦 版本管理 |
| 36 | 36 | ||
| 37 | -> 💡 **该用哪个版本**:本仓库默认分支 `main` 为**版本演进分支**(当前承载新版本探索开发,不保证稳定性),生产环境请勿直接依赖;生产接入请安装 npm dist-tag `0.XX-stable` 形式的稳定版(如 `@react-native-oh/react-native-harmony@0.82-stable`,命名对齐上游 `react-native`,随迭代自动前移)。**当前推荐**:新项目生产接入首选 `0.82-stable`(最新 GA)。各版本线状态一览见 [稳定版本识别与安装 · 推荐版本判定表](./docs/zh-cn/05-运维/稳定版本识别与安装.md)。 | 37 | +> 💡 **该用哪个版本**:本仓库默认分支 `main` 为**版本演进分支**(当前承载新版本探索开发,不保证稳定性),生产环境请勿直接依赖;生产接入请安装 npm dist-tag `0.XX-stable` 形式的稳定版(如 `@react-native-oh/react-native-harmony@0.82-stable`,命名对齐上游 `react-native`,随迭代自动前移)。**当前建议**:`0.82-stable`(最新 GA)为新项目生产接入首选。各版本线状态一览见 [稳定版本识别与安装 · 推荐版本判定表](./docs/zh-cn/05-运维/稳定版本识别与安装.md)。 |
| 38 | 38 | ||
| 39 | | 文档 | 说明 | | 39 | | 文档 | 说明 | |
| 40 | | ---------------------------------------------------------------------------- | ---------------------------- | | 40 | | ---------------------------------------------------------------------------- | ---------------------------- | |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ## JS to Native Messaging | 3 | ## JS to Native Messaging |
| 4 | 4 | ||
| 5 | -JS to native messaging requires the [TurboModule](https://reactnative.dev/docs/0.86/turbo-native-modules-introduction) module. If you want to implement your own TurboModule, refer to [Custom TurboModule](../02-development/02-development-guide/TurboModule.md). | 5 | +JS to native messaging requires the [TurboModule](https://reactnative.dev/docs/0.88/turbo-native-modules-introduction) module. If you want to implement your own TurboModule, refer to [Custom TurboModule](../02-development/02-development-guide/TurboModule.md). |
| 6 | 6 | ||
| 7 | ## Native to JS Messaging | 7 | ## Native to JS Messaging |
| 8 | 8 | ||
| @@ -169,7 +169,7 @@ | |||
| 169 | 169 | ||
| 170 | a. Install and check the toolchain. | 170 | a. Install and check the toolchain. |
| 171 | 171 | ||
| 172 | - The default shell on HarmonyOS PC is zsh (configuration file `~/.zshrc`), but the current system version does not come with Harmonybrew. You need to install Harmonybrew first. Node.js / npm and the C++ build tools (git, cmake, and ninja) are installed through Harmonybrew, and the node version currently provided by Harmonybrew is 22.11.0: | 172 | + The default shell on HarmonyOS PC is zsh (configuration file `~/.zshrc`), but the current system version does not come with Harmonybrew. You need to install Harmonybrew first. Node.js / npm and the C++ build tools (git, cmake, and ninja) are installed through Harmonybrew. The RN 0.88 upgrade template uses Node.js 22.11.0 or later; verify the installed version with `node --version`: |
| 173 | 173 | ||
| 174 | - Check whether Harmonybrew is installed on the system: | 174 | - Check whether Harmonybrew is installed on the system: |
| 175 | 175 | ||
| @@ -211,10 +211,10 @@ This section describes how to initialize the React Native project, install the O | |||
| 211 | 211 | ||
| 212 | ## Creating a Project | 212 | ## Creating a Project |
| 213 | 213 | ||
| 214 | -You can select a directory, for example, the root directory of drive D, and use `@react-native-community/cli` to create a project named **AwesomeProject**. This tool does not need to be installed globally - you can run it directly with the `npx` command bundled with Node. React Native for OpenHarmony is adapted from upstream RN **0.86.3**. Specify the RN version with `--version`: | 214 | +You can select a directory, for example, the root directory of drive D, and use `@react-native-community/cli` to create a project named **AwesomeProject**. This tool does not need to be installed globally - you can run it directly with the `npx` command bundled with Node. React Native for OpenHarmony is adapted from upstream RN **0.88.1**. Specify the RN version with `--version`: |
| 215 | 215 | ||
| 216 | ```bash | 216 | ```bash |
| 217 | -npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 | 217 | +npx @react-native-community/cli@latest init AwesomeProject --version 0.88.1 |
| 218 | ``` | 218 | ``` |
| 219 | 219 | ||
| 220 | > **Note**: `npx react-native init` is deprecated - do not use it. If you see a warning such as `NPX has cached version != current release`, you can ignore it; project creation is not affected. | 220 | > **Note**: `npx react-native init` is deprecated - do not use it. If you see a warning such as `NPX has cached version != current release`, you can ignore it; project creation is not affected. |
| @@ -224,7 +224,7 @@ npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 | |||
| 224 | When this command is used to initialize the React Native project on macOS, the iOS dependency library is downloaded, which takes a long time. You can run the following command to skip this process and download the library as required. This does not affect the development of the OpenHarmony project. | 224 | When this command is used to initialize the React Native project on macOS, the iOS dependency library is downloaded, which takes a long time. You can run the following command to skip this process and download the library as required. This does not affect the development of the OpenHarmony project. |
| 225 | 225 | ||
| 226 | ```bash | 226 | ```bash |
| 227 | -npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 --skip-install | 227 | +npx @react-native-community/cli@latest init AwesomeProject --version 0.88.1 --skip-install |
| 228 | ``` | 228 | ``` |
| 229 | 229 | ||
| 230 |  | 230 |  |
| @@ -254,29 +254,29 @@ For details about the version mapping of the files used in this section, see [Re | |||
| 254 | + "dev": "react-native bundle-harmony --dev" | 254 | + "dev": "react-native bundle-harmony --dev" |
| 255 | }, | 255 | }, |
| 256 | "dependencies": { | 256 | "dependencies": { |
| 257 | - + "@react-native-oh/react-native-harmony": "0.86.1", | 257 | + + "@react-native-oh/react-native-harmony": "0.88.1", |
| 258 | - + "@react-native-oh/react-native-harmony-cli": "0.86.1", | 258 | + "react": "19.3.0", |
| 259 | - "react": "19.2.3", | 259 | + "react-native": "0.88.1" |
| 260 | - "react-native": "0.86.3" | ||
| 261 | }, | 260 | }, |
| 262 | "devDependencies": { | 261 | "devDependencies": { |
| 263 | "@babel/core": "^7.25.2", | 262 | "@babel/core": "^7.25.2", |
| 264 | "@babel/preset-env": "^7.25.3", | 263 | "@babel/preset-env": "^7.25.3", |
| 265 | "@babel/runtime": "^7.25.0", | 264 | "@babel/runtime": "^7.25.0", |
| 266 | - "@react-native-community/cli": "20.1.0", | 265 | + "@react-native-community/cli": "20.2.0", |
| 267 | - "@react-native-community/cli-platform-android": "20.1.0", | 266 | + "@react-native-community/cli-platform-android": "20.2.0", |
| 268 | - "@react-native-community/cli-platform-ios": "20.1.0", | 267 | + "@react-native-community/cli-platform-ios": "20.2.0", |
| 269 | - "@react-native/babel-preset": "0.86.3", | 268 | + + "@react-native-oh/react-native-harmony-cli": "0.88.1", |
| 270 | - "@react-native/eslint-config": "0.86.3", | 269 | + "@react-native/babel-preset": "0.88.1", |
| 271 | - "@react-native/metro-config": "0.86.3", | 270 | + "@react-native/eslint-config": "0.88.1", |
| 272 | - "@react-native/typescript-config": "0.86.3", | 271 | + "@react-native/metro-config": "0.88.1", |
| 272 | + "@react-native/typescript-config": "0.88.1", | ||
| 273 | "@types/jest": "^29.5.13", | 273 | "@types/jest": "^29.5.13", |
| 274 | "@types/react": "^19.2.0", | 274 | "@types/react": "^19.2.0", |
| 275 | "@types/react-test-renderer": "^19.1.0", | 275 | "@types/react-test-renderer": "^19.1.0", |
| 276 | "eslint": "^8.19.0", | 276 | "eslint": "^8.19.0", |
| 277 | "jest": "^29.6.3", | 277 | "jest": "^29.6.3", |
| 278 | "prettier": "2.8.8", | 278 | "prettier": "2.8.8", |
| 279 | - "react-test-renderer": "19.2.3", | 279 | + "react-test-renderer": "19.3.0", |
| 280 | "typescript": "^5.8.3" | 280 | "typescript": "^5.8.3" |
| 281 | }, | 281 | }, |
| 282 | "engines": { | 282 | "engines": { |
| @@ -285,16 +285,16 @@ For details about the version mapping of the files used in this section, see [Re | |||
| 285 | } | 285 | } |
| 286 | ``` | 286 | ``` |
| 287 | 287 | ||
| 288 | -2. Run the following command in the `AwesomeProject` directory to install the dependency package: | 288 | +2. Run the following command in the `AwesomeProject` directory to install the dependency packages: |
| 289 | 289 | ||
| 290 | ```bash | 290 | ```bash |
| 291 | - npm install @react-native-oh/react-native-harmony@0.86.1 @react-native-oh/react-native-harmony-cli@0.86.1 | 291 | + npm install @react-native-oh/react-native-harmony@0.88.1 @react-native-oh/react-native-harmony-cli@0.88.1 |
| 292 | ``` | 292 | ``` |
| 293 | 293 | ||
| 294 | > **Note**: | 294 | > **Note**: |
| 295 | > | 295 | > |
| 296 | - > 1. It is recommended to use the stable dist-tag of the corresponding version line (for example, `0.86-stable`) to obtain the latest stable version: `npm install @react-native-oh/react-native-harmony@0.86-stable`. For versions and installation methods, see [RNOH Version Information](../../05-operations/release-notes-overview.md). | 296 | + > 1. For production, install a published stable dist-tag (for example, `0.82-stable`). The 0.88 line is not published to npm yet; use a local package instead. For versions and installation methods, see [RNOH Version Information](../../05-operations/release-notes-overview.md). |
| 297 | - > 2. For local installation of Harmony dependencies, see [How to use local installation of HarmonyOS dependencies](../../05-operations/version-upgrade-guide.md#how-to-use-local-installation-of-harmonyos-dependencies). | 297 | + > 2. For local installation of HarmonyOS dependencies, see [How to use local installation of HarmonyOS dependencies](../../05-operations/version-upgrade-guide.md#how-to-use-local-installation-of-harmonyos-dependencies). |
| 298 | > 3. To switch from local dependencies to remote dependencies, see [How to switch from local dependencies to remote dependencies](../../05-operations/version-upgrade-guide.md#how-to-switch-from-local-dependencies-to-remote-dependencies). | 298 | > 3. To switch from local dependencies to remote dependencies, see [How to switch from local dependencies to remote dependencies](../../05-operations/version-upgrade-guide.md#how-to-switch-from-local-dependencies-to-remote-dependencies). |
| 299 | 299 | ||
| 300 |  | 300 |  |
| @@ -359,7 +359,7 @@ The following demonstrates how to integrate a project. Click `File > New > Creat | |||
| 359 | 359 | ||
| 360 |  | 360 |  |
| 361 | 361 | ||
| 362 | -Click `Next` and select **API17** for `Compile SDK` (minimum for RNOH 0.86.1; requires DevEco Studio 6.1.0 or later) to create a project named **MyApplication**. Note that the project path cannot be too long, as shown in the following figure. | 362 | +Click `Next` and select **API 26** for `Compile SDK` (RNOH 0.88.1 baseline; requires DevEco Studio 26.0.0 or later) to create a project named **MyApplication**. Note that the project path cannot be too long, as shown in the following figure. |
| 363 | 363 | ||
| 364 |  | 364 |  |
| 365 | 365 | ||
| @@ -647,7 +647,7 @@ const styles = StyleSheet.create({ | |||
| 647 | export default App; | 647 | export default App; |
| 648 | ``` | 648 | ``` |
| 649 | 649 | ||
| 650 | -> After the content replacement is completed, a new bundle package needs to be generated. | 650 | +> After replacing the content, run `npm run dev` (or `npx react-native bundle-harmony --dev`) to regenerate `harmony/entry/src/main/resources/rawfile/bundle.harmony.js` and `assets`, then re-sync and rebuild the HarmonyOS project. |
| 651 | 651 | ||
| 652 | ## Using the Release Package | 652 | ## Using the Release Package |
| 653 | 653 | ||
| @@ -705,7 +705,8 @@ export default App; | |||
| 705 | { | 705 | { |
| 706 | "name": "default", | 706 | "name": "default", |
| 707 | "signingConfig": "default", | 707 | "signingConfig": "default", |
| 708 | - "compatibleSdkVersion": "5.0.1(13)", | 708 | + "compatibleSdkVersion": "5.0.0(12)", |
| 709 | + "targetSdkVersion": "26.0.0", | ||
| 709 | "runtimeOS": "HarmonyOS", | 710 | "runtimeOS": "HarmonyOS", |
| 710 | + "buildOption": { | 711 | + "buildOption": { |
| 711 | + "strictMode": { | 712 | + "strictMode": { |
| @@ -6,7 +6,7 @@ A OpenHarmony-based Codegen is also created in RNOH, which is described below. | |||
| 6 | 6 | ||
| 7 | ## Environment Setup | 7 | ## Environment Setup |
| 8 | 8 | ||
| 9 | -RNOH `Codegen` has been supported since version 0.72.13 and remains available on the **0.86.x** line. To use `Codegen`, install `@react-native-oh/react-native-harmony` and `@react-native-oh/react-native-harmony-cli`. For versions, see [Release Notes Overview](../../05-operations/release-notes-overview.md). | 9 | +RNOH `Codegen` has been supported since version 0.72.13 and remains available on the **0.88.x** line. To use `Codegen`, install `@react-native-oh/react-native-harmony` and `@react-native-oh/react-native-harmony-cli`. For versions, see [Release Notes Overview](../../05-operations/release-notes-overview.md). |
| 10 | 10 | ||
| 11 | The following two demo projects describe how to use the `Codegen`: | 11 | The following two demo projects describe how to use the `Codegen`: |
| 12 | 12 | ||
| @@ -41,7 +41,7 @@ Codegen configuration involves the following scenarios: | |||
| 41 | #### 1. codegenConfig | 41 | #### 1. codegenConfig |
| 42 | 42 | ||
| 43 | For Android and iOS, Codegen generates code based on **codegenConfig** in the **package.json** file of the third-party library or frontend project. Note that the `codegenConfig` field in RNOH must be nested in `harmony`. For example: | 43 | For Android and iOS, Codegen generates code based on **codegenConfig** in the **package.json** file of the third-party library or frontend project. Note that the `codegenConfig` field in RNOH must be nested in `harmony`. For example: |
| 44 | -Guides: https://reactnative.dev/docs/0.86/the-new-architecture/using-codegen | 44 | +Guides: https://reactnative.dev/docs/0.88/the-new-architecture/using-codegen |
| 45 | 45 | ||
| 46 | ```json | 46 | ```json |
| 47 | ... | 47 | ... |
| @@ -1,4 +1,4 @@ | |||
| 1 | -This documentation is based on React Native documentation licensed under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license at https://reactnative.dev/docs/0.86/turbo-native-modules-introduction. © Meta Platforms Inc. Changed to How to create a TurboModule on OpenHarmony. | 1 | +This documentation is based on React Native documentation licensed under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license at https://reactnative.dev/docs/0.88/turbo-native-modules-introduction. © Meta Platforms Inc. Changed to How to create a TurboModule on OpenHarmony. |
| 2 | 2 | ||
| 3 | # Implementing a Custom TurboModule | 3 | # Implementing a Custom TurboModule |
| 4 | 4 | ||
| @@ -84,8 +84,8 @@ Add `package.json` to the `RTNCalculator` directory: | |||
| 84 | }, | 84 | }, |
| 85 | "devDependencies": { | 85 | "devDependencies": { |
| 86 | "@types/react": "^19.2.0", | 86 | "@types/react": "^19.2.0", |
| 87 | - "react": "19.2.3", | 87 | + "react": "19.3.0", |
| 88 | - "react-native": "0.86.3" | 88 | + "react-native": "0.88.1" |
| 89 | }, | 89 | }, |
| 90 | "dependencies": {} | 90 | "dependencies": {} |
| 91 | } | 91 | } |
| @@ -241,7 +241,7 @@ For detailed instructions on using Codegen, see the [Codegen](Codegen.md) docume | |||
| 241 | 241 | ||
| 242 | 3. For a CxxTurboModule, additional steps are required: | 242 | 3. For a CxxTurboModule, additional steps are required: |
| 243 | 243 | ||
| 244 | - For an introduction to CxxTurboModule, see the [React Native documentation](https://reactnative.dev/docs/0.86/the-new-architecture/pure-cxx-modules). | 244 | + For an introduction to CxxTurboModule, see the [React Native documentation](https://reactnative.dev/docs/0.88/the-new-architecture/pure-cxx-modules). |
| 245 | 245 | ||
| 246 | Using CalculatorModule as an example, expand the ARK_ASYNC_METHOD_METADATA macro in the glue code file `RTNCalculator.cpp`: | 246 | Using CalculatorModule as an example, expand the ARK_ASYNC_METHOD_METADATA macro in the glue code file `RTNCalculator.cpp`: |
| 247 | 247 | ||
| @@ -32,7 +32,7 @@ Add dependency in HarmonyOS project's `oh-package.json5`: | |||
| 32 | ```json5 | 32 | ```json5 |
| 33 | { | 33 | { |
| 34 | dependencies: { | 34 | dependencies: { |
| 35 | - "@rnoh/react-native-openharmony": "0.86.1", // Use Debug version | 35 | + "@rnoh/react-native-openharmony": "0.88.1", // Use Debug version |
| 36 | }, | 36 | }, |
| 37 | } | 37 | } |
| 38 | ``` | 38 | ``` |
| @@ -137,7 +137,7 @@ Or use npm version: | |||
| 137 | ```json5 | 137 | ```json5 |
| 138 | { | 138 | { |
| 139 | dependencies: { | 139 | dependencies: { |
| 140 | - "@rnoh/react-native-openharmony": "0.86.1", // Specify version | 140 | + "@rnoh/react-native-openharmony": "0.88.1", // Specify version |
| 141 | }, | 141 | }, |
| 142 | } | 142 | } |
| 143 | ``` | 143 | ``` |
| @@ -333,7 +333,7 @@ add_compile_definitions( | |||
| 333 | 1. Open DevEco Studio | 333 | 1. Open DevEco Studio |
| 334 | 2. **File > Settings > HarmonyOS SDK** | 334 | 2. **File > Settings > HarmonyOS SDK** |
| 335 | 3. Configure SDK path and version: | 335 | 3. Configure SDK path and version: |
| 336 | - - HarmonyOS SDK: Recommend API 10 or higher | 336 | + - HarmonyOS SDK: use API 26 as the target SDK, matching the repository templates (`compatibleSdkVersion` 5.0.0(12), `targetSdkVersion` 26.0.0). Select the compile SDK available in the target DevEco installation and validate the resulting device ROM. |
| 337 | - Native SDK: Includes NDK toolchain | 337 | - Native SDK: Includes NDK toolchain |
| 338 | 338 | ||
| 339 | #### NDK Configuration | 339 | #### NDK Configuration |
| @@ -385,7 +385,7 @@ Use the Debug HAR package. The .so files contain full symbols and can be debugge | |||
| 385 | ### 9.2 Production Debugging | 385 | ### 9.2 Production Debugging |
| 386 | 386 | ||
| 387 | 1. Use the Release HAR package | 387 | 1. Use the Release HAR package |
| 388 | -2. Obtain the matching .sym files: download the symbol archive `rnoh-symbols-<version>-release.tar.gz` (for example, `rnoh-symbols-0.86.1-release.tar.gz`) from the RNOH Release page and extract it. .sym files are not distributed with the npm package; the package does not contain a `symbols/` directory | 388 | +2. Obtain the matching .sym files: download the symbol archive `rnoh-symbols-<version>-release.tar.gz` (for example, `rnoh-symbols-0.88.1-release.tar.gz`) from the RNOH Release page and extract it. .sym files are not distributed with the npm package; the package does not contain a `symbols/` directory |
| 389 | 3. Upload the .sym files to a crash analysis platform (such as Bugly or Sentry) | 389 | 3. Upload the .sym files to a crash analysis platform (such as Bugly or Sentry) |
| 390 | 4. Use the .sym files to resolve crash stacks | 390 | 4. Use the .sym files to resolve crash stacks |
| 391 | 391 | ||
Mdocs/en/02-development/03-scenarios-and-practices/react-native-app-harmony-development-guide.md+17-17
| @@ -32,10 +32,10 @@ RN development consists of native project development and JS project development | |||
| 32 | 32 | ||
| 33 | ### Creating a New RN JS Project | 33 | ### Creating a New RN JS Project |
| 34 | 34 | ||
| 35 | -Choose a directory and use `@react-native-community/cli` to create a project named GuideJS. No global installation is required: run it with `npx`, which comes with Node.js. The React Native for OpenHarmony version covered here is based on upstream RN **0.86.3**. Specify the RN version with `--version`: | 35 | +Choose a directory and use `@react-native-community/cli` to create a project named GuideJS. No global installation is required: run it with `npx`, which comes with Node.js. The React Native for OpenHarmony version covered here is based on upstream RN **0.88.1**. Specify the RN version with `--version`: |
| 36 | 36 | ||
| 37 | ```bash | 37 | ```bash |
| 38 | -npx @react-native-community/cli@latest init GuideJS --version 0.86.3 | 38 | +npx @react-native-community/cli@latest init GuideJS --version 0.88.1 |
| 39 | ``` | 39 | ``` |
| 40 | 40 | ||
| 41 |  | 41 |  |
| @@ -45,7 +45,7 @@ npx @react-native-community/cli@latest init GuideJS --version 0.86.3 | |||
| 45 | On macOS, this command downloads iOS dependencies during initialization, which can take some time. Use the following command to skip this step and download them later if needed. This does not affect HarmonyOS development: | 45 | On macOS, this command downloads iOS dependencies during initialization, which can take some time. Use the following command to skip this step and download them later if needed. This does not affect HarmonyOS development: |
| 46 | 46 | ||
| 47 | ```bash | 47 | ```bash |
| 48 | -npx @react-native-community/cli@latest init GuideJS --version 0.86.3 --skip-install | 48 | +npx @react-native-community/cli@latest init GuideJS --version 0.88.1 --skip-install |
| 49 | ``` | 49 | ``` |
| 50 | 50 | ||
| 51 | This creates a basic RN JS project for Android and iOS, with native projects in the `android` and `ios` directories. To add HarmonyOS support, create a `harmony` directory at the project root for the HarmonyOS native project. The resulting structure is shown below: | 51 | This creates a basic RN JS project for Android and iOS, with native projects in the `android` and `ios` directories. To add HarmonyOS support, create a `harmony` directory at the project root for the HarmonyOS native project. The resulting structure is shown below: |
| @@ -66,27 +66,27 @@ This creates a basic RN JS project for Android and iOS, with native projects in | |||
| 66 | + "dev": "react-native bundle-harmony --dev" | 66 | + "dev": "react-native bundle-harmony --dev" |
| 67 | }, | 67 | }, |
| 68 | "dependencies": { | 68 | "dependencies": { |
| 69 | - "react": "19.2.3", | 69 | + "react": "19.3.0", |
| 70 | - "react-native": "0.86.3" | 70 | + "react-native": "0.88.1" |
| 71 | }, | 71 | }, |
| 72 | "devDependencies": { | 72 | "devDependencies": { |
| 73 | "@babel/core": "^7.25.2", | 73 | "@babel/core": "^7.25.2", |
| 74 | "@babel/preset-env": "^7.25.3", | 74 | "@babel/preset-env": "^7.25.3", |
| 75 | "@babel/runtime": "^7.25.0", | 75 | "@babel/runtime": "^7.25.0", |
| 76 | - "@react-native-community/cli": "20.1.0", | 76 | + "@react-native-community/cli": "20.2.0", |
| 77 | - "@react-native-community/cli-platform-android": "20.1.0", | 77 | + "@react-native-community/cli-platform-android": "20.2.0", |
| 78 | - "@react-native-community/cli-platform-ios": "20.1.0", | 78 | + "@react-native-community/cli-platform-ios": "20.2.0", |
| 79 | - "@react-native/babel-preset": "0.86.3", | 79 | + "@react-native/babel-preset": "0.88.1", |
| 80 | - "@react-native/eslint-config": "0.86.3", | 80 | + "@react-native/eslint-config": "0.88.1", |
| 81 | - "@react-native/metro-config": "0.86.3", | 81 | + "@react-native/metro-config": "0.88.1", |
| 82 | - "@react-native/typescript-config": "0.86.3", | 82 | + "@react-native/typescript-config": "0.88.1", |
| 83 | "@types/jest": "^29.5.13", | 83 | "@types/jest": "^29.5.13", |
| 84 | "@types/react": "^19.2.0", | 84 | "@types/react": "^19.2.0", |
| 85 | - "@types/react-test-renderer": "^19.2.0", | 85 | + "@types/react-test-renderer": "^19.1.0", |
| 86 | "eslint": "^8.19.0", | 86 | "eslint": "^8.19.0", |
| 87 | "jest": "^29.6.3", | 87 | "jest": "^29.6.3", |
| 88 | "prettier": "2.8.8", | 88 | "prettier": "2.8.8", |
| 89 | - "react-test-renderer": "19.2.3", | 89 | + "react-test-renderer": "19.3.0", |
| 90 | "typescript": "^5.8.3" | 90 | "typescript": "^5.8.3" |
| 91 | }, | 91 | }, |
| 92 | "engines": { | 92 | "engines": { |
| @@ -113,7 +113,7 @@ npm i @react-native-oh/react-native-harmony-cli@x.x.x | |||
| 113 | 113 | ||
| 114 | ### Generating a Bundle from the RN JS Project | 114 | ### Generating a Bundle from the RN JS Project |
| 115 | 115 | ||
| 116 | -1. Open `GuideJS/metro.config.js` and add the OpenHarmony configuration. For configuration details, see the [React Native Metro documentation](https://reactnative.dev/docs/0.86/metro). The updated file is shown below: | 116 | +1. Open `GuideJS/metro.config.js` and add the OpenHarmony configuration. For configuration details, see the [React Native Metro documentation](https://reactnative.dev/docs/0.88/metro). The updated file is shown below: |
| 117 | 117 | ||
| 118 | ```javascript | 118 | ```javascript |
| 119 | const { mergeConfig, getDefaultConfig } = require("@react-native/metro-config"); | 119 | const { mergeConfig, getDefaultConfig } = require("@react-native/metro-config"); |
| @@ -238,10 +238,10 @@ Example: | |||
| 238 | "version": "1.0.0", | 238 | "version": "1.0.0", |
| 239 | "private": true, | 239 | "private": true, |
| 240 | "dependencies": { | 240 | "dependencies": { |
| 241 | - "@react-native-oh/react-native-harmony": "0.86.1" | 241 | + "@react-native-oh/react-native-harmony": "0.88.1" |
| 242 | }, | 242 | }, |
| 243 | "devDependencies": { | 243 | "devDependencies": { |
| 244 | - "react-native": "0.86.3" | 244 | + "react-native": "0.88.1" |
| 245 | } | 245 | } |
| 246 | } | 246 | } |
| 247 | ``` | 247 | ``` |
| @@ -516,7 +516,7 @@ I. Create rnoh static module | |||
| 516 | II. Compile rnoh release | 516 | II. Compile rnoh release |
| 517 | 517 | ||
| 518 | 1. Extract the react_native_openharmony_release-x.x.x.xxx.har provided by Huawei. | 518 | 1. Extract the react_native_openharmony_release-x.x.x.xxx.har provided by Huawei. |
| 519 | -2. Copy the extracted src/main/include folder to the new module. | 519 | +2. Copy the extracted `include/` folder to the new module. |
| 520 | 3. Modify new module's src/main/cpp/CMakeLists.txt. | 520 | 3. Modify new module's src/main/cpp/CMakeLists.txt. |
| 521 | 4. Modify new module's build-profile.json5. | 521 | 4. Modify new module's build-profile.json5. |
| 522 | 522 | ||
| @@ -1,7 +1,5 @@ | |||
| 1 | # Debugging | 1 | # Debugging |
| 2 | 2 | ||
| 3 | -> WARNING: This document hasn't been updated for RNOH 0.86. | ||
| 4 | - | ||
| 5 | ## Metro Hot Reloading | 3 | ## Metro Hot Reloading |
| 6 | 4 | ||
| 7 | `React Native` uses [`Metro`](https://metrobundler.dev/) to build your `JavaScript` code and assets. This section describes how to configure and use Metro. | 5 | `React Native` uses [`Metro`](https://metrobundler.dev/) to build your `JavaScript` code and assets. This section describes how to configure and use Metro. |
| @@ -257,6 +257,30 @@ Add folly to the compilation build; import the missing folly in `CMakeLists.txt` | |||
| 257 | target_link_libraries(xxx PUBLIC ${folly_compile_options}) | 257 | target_link_libraries(xxx PUBLIC ${folly_compile_options}) |
| 258 | ``` | 258 | ``` |
| 259 | 259 | ||
| 260 | +## Release Version Compilation Reports Missing fast_float / folly / hermes Headers | ||
| 261 | + | ||
| 262 | +**Symptom** | ||
| 263 | + | ||
| 264 | +Building with a release / release2 HAR fails with errors such as: | ||
| 265 | + | ||
| 266 | +- `fatal error: 'fast_float/fast_float.h' file not found` | ||
| 267 | +- or missing `folly/...` / `hermes/hermes.h` headers | ||
| 268 | + | ||
| 269 | +**Cause** | ||
| 270 | + | ||
| 271 | +Release packages ship prebuilt `.so` libraries and public headers under `include/` (including `include/third-party/fast_float/include`). If `CMakeLists.txt` still uses the Debug-style `add_subdirectory(src/main/cpp)` path, or does not `include(react-native-harmony.cmake)`, those header search paths are never applied. | ||
| 272 | + | ||
| 273 | +**Fix** | ||
| 274 | + | ||
| 275 | +1. Point `RNOH_CPP_DIR` to `oh_modules/@rnoh/react-native-openharmony/include` (not `src/main/cpp`). | ||
| 276 | +2. Use the documented unified CMake include: | ||
| 277 | + ```cmake | ||
| 278 | + include("${RNOH_CPP_DIR}/react-native-harmony.cmake") | ||
| 279 | + ``` | ||
| 280 | + This cmake already adds `third-party/fast_float/include`, `folly`, `hermes`, and related paths. | ||
| 281 | +3. Delete `entry/oh_modules`, clean `.cxx`/`build`, then **Sync and Refresh Project** and rebuild. | ||
| 282 | +4. If a third-party library still misses headers, locate them under `include/` and add the path to that library's own `include_directories` (see the hermes example below). | ||
| 283 | + | ||
| 260 | ## Release Version Compilation Reports <hermes/hermes.h> Header File Not Found | 284 | ## Release Version Compilation Reports <hermes/hermes.h> Header File Not Found |
| 261 | 285 | ||
| 262 | - Symptom | 286 | - Symptom |
| @@ -269,7 +293,7 @@ target_link_libraries(xxx PUBLIC ${folly_compile_options}) | |||
| 269 | 293 | ||
| 270 | - Solution | 294 | - Solution |
| 271 | 295 | ||
| 272 | - In the Release version of RNOH, the header files have all been extracted and placed in the `src/main/include` folder. If you encounter the preceding error, find the corresponding file in the `include` folder and configure its path in **include_directories** of `CMakeLists.txt`. For example, for the preceding problem, the fix is: | 296 | + In the Release version of RNOH, the header files have all been extracted into the HAR `include` directory (`oh_modules/@rnoh/react-native-openharmony/include`). If you encounter the preceding error, find the corresponding file under that directory and configure its path in **include_directories** of `CMakeLists.txt`. For example, for the preceding problem, the fix is: |
| 273 | 297 | ||
| 274 | ```diff | 298 | ```diff |
| 275 | # Add the header file directory | 299 | # Add the header file directory |
| @@ -40,7 +40,7 @@ Before using AI-assisted diagnosis, prepare: | |||
| 40 | 40 | ||
| 41 | 2. **Version Information** | 41 | 2. **Version Information** |
| 42 | 42 | ||
| 43 | - - RNOH version (e.g., 0.72.53, 0.77.18, 0.82.3, 0.84.1, 0.86.1) | 43 | + - RNOH version (e.g., 0.72.53, 0.77.18, 0.82.3, 0.84.1, 0.88.1) |
| 44 | - React Native version | 44 | - React Native version |
| 45 | - HarmonyOS API Level | 45 | - HarmonyOS API Level |
| 46 | 46 | ||
| @@ -48,7 +48,7 @@ This directory contains version management, stability management, and build and | |||
| 48 | ├── AI-assisted-issue-diagnosis-guide.md # AI-assisted diagnosis | 48 | ├── AI-assisted-issue-diagnosis-guide.md # AI-assisted diagnosis |
| 49 | │ | 49 | │ |
| 50 | ├── release-notes/ # Detailed release notes ⚡version-related | 50 | ├── release-notes/ # Detailed release notes ⚡version-related |
| 51 | -│ └── react-native-harmony-v0.86.1.md | 51 | +│ └── react-native-harmony-v0.88.1.md |
| 52 | │ | 52 | │ |
| 53 | ├── stability-coding-standards/ # Coding standards | 53 | ├── stability-coding-standards/ # Coding standards |
| 54 | │ └── stability-coding-standards.md | 54 | │ └── stability-coding-standards.md |
| @@ -8,7 +8,7 @@ In UI adaptation, React Native provides several methods to set UI component heig | |||
| 8 | 8 | ||
| 9 | ## Flexbox Layout | 9 | ## Flexbox Layout |
| 10 | 10 | ||
| 11 | -**Official Documentation: [Using Flexbox Layout](https://reactnative.dev/docs/0.86/flexbox)** | 11 | +**Official Documentation: [Using Flexbox Layout](https://reactnative.dev/docs/0.88/flexbox)** |
| 12 | 12 | ||
| 13 | Flexbox is a CSS layout model designed to provide flexible, adaptive arrangement for web pages. In React Native, Flexbox rules are used to specify child element layout of components. Flexbox can provide consistent layout structure across different screen sizes. | 13 | Flexbox is a CSS layout model designed to provide flexible, adaptive arrangement for web pages. In React Native, Flexbox rules are used to specify child element layout of components. Flexbox can provide consistent layout structure across different screen sizes. |
| 14 | 14 | ||
| @@ -44,13 +44,13 @@ Specifying `justifyContent` in component's `style` determines child elements' ** | |||
| 44 | - `space-around`: Evenly distribute child elements on container's main axis, distributing remaining space around each child element. | 44 | - `space-around`: Evenly distribute child elements on container's main axis, distributing remaining space around each child element. |
| 45 | - `space-evenly`: Evenly distribute child items along main axis in alignment container. | 45 | - `space-evenly`: Evenly distribute child items along main axis in alignment container. |
| 46 | 46 | ||
| 47 | -For more layout properties and sample code, refer to [Official Documentation](https://reactnative.dev/docs/0.86/flexbox). | 47 | +For more layout properties and sample code, refer to [Official Documentation](https://reactnative.dev/docs/0.88/flexbox). |
| 48 | 48 | ||
| 49 | ## Device Type + Pixel Density | 49 | ## Device Type + Pixel Density |
| 50 | 50 | ||
| 51 | ### isPad, isTV | 51 | ### isPad, isTV |
| 52 | 52 | ||
| 53 | -**Official Documentation: [Platform API](https://reactnative.dev/docs/0.86/platform#ispad-ios)** | 53 | +**Official Documentation: [Platform API](https://reactnative.dev/docs/0.88/platform#ispad-ios)** |
| 54 | 54 | ||
| 55 | `Platform API` contains `isPad` and `isTV` methods, returning boolean values to determine if current device is iPad or TV. | 55 | `Platform API` contains `isPad` and `isTV` methods, returning boolean values to determine if current device is iPad or TV. |
| 56 | 56 | ||
| @@ -58,7 +58,7 @@ For more layout properties and sample code, refer to [Official Documentation](ht | |||
| 58 | 58 | ||
| 59 | ### PixelRatio | 59 | ### PixelRatio |
| 60 | 60 | ||
| 61 | -**Official Documentation: [PixelRatio API](https://reactnative.dev/docs/0.86/pixelratio)** | 61 | +**Official Documentation: [PixelRatio API](https://reactnative.dev/docs/0.88/pixelratio)** |
| 62 | 62 | ||
| 63 | `PixelRatio` can get device pixel density and font scale ratio. | 63 | `PixelRatio` can get device pixel density and font scale ratio. |
| 64 | 64 | ||
| @@ -119,7 +119,7 @@ For more layout properties and sample code, refer to [Official Documentation](ht | |||
| 119 | 119 | ||
| 120 | ## Dimensions API | 120 | ## Dimensions API |
| 121 | 121 | ||
| 122 | -**Official Documentation: [Dimensions API](https://reactnative.dev/docs/0.86/dimensions)** | 122 | +**Official Documentation: [Dimensions API](https://reactnative.dev/docs/0.88/dimensions)** |
| 123 | 123 | ||
| 124 | For obtaining device screen dimensions in device-independent pixels, React Native provides the `Dimensions API`. By calling `Dimensions.get()`, you can obtain an object containing the screen width and height, to gauge the screen size of the current user's device and roughly infer whether the user is in landscape orientation. | 124 | For obtaining device screen dimensions in device-independent pixels, React Native provides the `Dimensions API`. By calling `Dimensions.get()`, you can obtain an object containing the screen width and height, to gauge the screen size of the current user's device and roughly infer whether the user is in landscape orientation. |
| 125 | 125 | ||
| @@ -146,7 +146,7 @@ The `Dimensions API` provides two methods: | |||
| 146 | 146 | ||
| 147 | Adds an event listener. Currently supported events: | 147 | Adds an event listener. Currently supported events: |
| 148 | 148 | ||
| 149 | - `change`: Triggered when properties inside the `Dimensions` object change. The parameter of the event handler is an object of the [`DimensionsValue`](https://reactnative.dev/docs/0.86/dimensions#dimensionsvalue) type. | 149 | + `change`: Triggered when properties inside the `Dimensions` object change. The parameter of the event handler is an object of the [`DimensionsValue`](https://reactnative.dev/docs/0.88/dimensions#dimensionsvalue) type. |
| 150 | 150 | ||
| 151 | - `get()` | 151 | - `get()` |
| 152 | 152 | ||
| @@ -160,7 +160,7 @@ The `Dimensions API` provides two methods: | |||
| 160 | 160 | ||
| 161 | ## useWindowDimensions Hook API | 161 | ## useWindowDimensions Hook API |
| 162 | 162 | ||
| 163 | -**Official Documentation: [useWindowDimensions Hook](https://reactnative.dev/docs/0.86/usewindowdimensions)** | 163 | +**Official Documentation: [useWindowDimensions Hook](https://reactnative.dev/docs/0.88/usewindowdimensions)** |
| 164 | 164 | ||
| 165 | `useWindowDimensions` returns the corresponding screen width and height based on the user's status bar, virtual menu bar, and whether the phone is held horizontally. You can build multiple screen breakpoints on top of this API to adaptively adjust the interface layout when breakpoints change. It automatically updates the obtained `width` and `height` values when the screen size changes. Usage: | 165 | `useWindowDimensions` returns the corresponding screen width and height based on the user's status bar, virtual menu bar, and whether the phone is held horizontally. You can build multiple screen breakpoints on top of this API to adaptively adjust the interface layout when breakpoints change. It automatically updates the obtained `width` and `height` values when the screen size changes. Usage: |
| 166 | 166 | ||
| @@ -207,7 +207,7 @@ const windowHeight = useWindowDimensions().height; | |||
| 207 | 207 | ||
| 208 | ## How to Adapt to Foldable Screens | 208 | ## How to Adapt to Foldable Screens |
| 209 | 209 | ||
| 210 | -To account for foldable devices, or other devices with variable screen sizes, you can refer to the event listener used in the following example, or [`useWindowDimensions`](https://reactnative.dev/docs/0.86/usewindowdimensions): | 210 | +To account for foldable devices, or other devices with variable screen sizes, you can refer to the event listener used in the following example, or [`useWindowDimensions`](https://reactnative.dev/docs/0.88/usewindowdimensions): |
| 211 | 211 | ||
| 212 | 1. How to sense screen changes | 212 | 1. How to sense screen changes |
| 213 | 213 | ||
| @@ -2,6 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | > This file is the Release Notes index; each version branch maintains its own release entries. **For how to choose and install stable versions, see [Identifying and Installing Stable Versions](./stable-version-identification-and-installation.md).** | 3 | > This file is the Release Notes index; each version branch maintains its own release entries. **For how to choose and install stable versions, see [Identifying and Installing Stable Versions](./stable-version-identification-and-installation.md).** |
| 4 | 4 | ||
| 5 | +## React Native for OpenHarmony 0.88 Release | ||
| 6 | + | ||
| 7 | +- [RNOH v0.88.1](./release-notes/react-native-harmony-v0.88.1.md) | ||
| 8 | + | ||
| 5 | ## React Native for OpenHarmony 0.86 Release | 9 | ## React Native for OpenHarmony 0.86 Release |
| 6 | 10 | ||
| 7 | - [RNOH v0.86.2 (2026-10-30)](./release-notes/react-native-harmony-v0.86.2.md) | 11 | - [RNOH v0.86.2 (2026-10-30)](./release-notes/react-native-harmony-v0.86.2.md) |
| @@ -0,0 +1,46 @@ | |||
| 1 | +# React Native Harmony Version Information | ||
| 2 | + | ||
| 3 | +This React Native Harmony release is adapted based on **community RN 0.88.1**. Release information is as follows: | ||
| 4 | + | ||
| 5 | +## Version Release Information | ||
| 6 | + | ||
| 7 | +| Name | Version | Version Type | npm URL | | ||
| 8 | +| ---------------------------- | ------- | ------------ | ------------------- | | ||
| 9 | +| react-native-harmony.tgz | 0.88.1 | beta | Internal test build | | ||
| 10 | +| react-native-harmony-cli.tgz | 0.88.1 | beta | Internal test build | | ||
| 11 | + | ||
| 12 | +## Compatible Version Information | ||
| 13 | + | ||
| 14 | +| Name | Version | | ||
| 15 | +| ------------------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| 16 | +| DevEco Studio | [DevEco Studio 26.0.0 Release](https://developer.huawei.com/consumer/en/download/deveco-studio) | | ||
| 17 | +| HarmonyOS SDK / ROM | HarmonyOS 26.0.0 (API 26) and device ROMs compatible with this target SDK | | ||
| 18 | +| Command Line Tools | [Command Line Tools 26.0.0 Release](https://developer.huawei.com/consumer/en/download/command-line-tools-for-hmos) | | ||
| 19 | +| Node.js | >=22.11.0, matching the upstream 0.86.0 → 0.88.1 upgrade template | | ||
| 20 | + | ||
| 21 | +## Source Code Release Address | ||
| 22 | + | ||
| 23 | +- GitCode: [https://gitcode.com/CPF-RN/ohos_react_native](https://gitcode.com/CPF-RN/ohos_react_native) | ||
| 24 | + | ||
| 25 | +## Target Version Requirements | ||
| 26 | + | ||
| 27 | +> The target OpenHarmony SDK version for this React Native Harmony release is API 26. For compatible toolchain versions, see: https://developer.huawei.com/consumer/en/doc/harmonyos-releases/deveco-studio-new-features-2600 | ||
| 28 | + | ||
| 29 | +## Minimum Version Requirements | ||
| 30 | + | ||
| 31 | +> The repository templates set `compatibleSdkVersion` to `5.0.0(12)` and `targetSdkVersion` to `26.0.0`. The compile SDK and device ROM must be selected and validated in the target DevEco/device matrix; this document does not certify every API or ROM combination. | ||
| 32 | + | ||
| 33 | +## Compatibility Notes | ||
| 34 | + | ||
| 35 | +> Use API 26 as the target SDK in the repository templates. Treat lower API or ROM combinations as a validation task for the target application rather than a blanket compatibility claim. | ||
| 36 | + | ||
| 37 | +## Change Notes | ||
| 38 | + | ||
| 39 | +- **New features:** | ||
| 40 | + - Aligns with upstream React Native 0.88.1, including default web-based event dispatching, `fontVariationSettings` variable fonts, and the React 19.3.0 / matching Metro baseline. | ||
| 41 | +- **Compatibility note:** | ||
| 42 | + - For dependency and project steps when upgrading from 0.86 to 0.88, see the [version upgrade guide](../version-upgrade-guide.md#upgrading-from-086x-to-088x). | ||
| 43 | +- **Toolchain companions:** | ||
| 44 | + - The repository baseline is DevEco Studio 26.0.0 / HarmonyOS SDK 26.0.0 / Command Line Tools 26.0.0; templates set `compatibleSdkVersion` 5.0.0(12) and `targetSdkVersion` 26.0.0. Verify the actual ROM and device before release. | ||
| 45 | + | ||
| 46 | +For the full changelog, see the repository-root `CHANGELOG.md` (updated with each release). | ||
| @@ -374,7 +374,7 @@ waitForSyncTask(task); | |||
| 374 | Historical Cases: | 374 | Historical Cases: |
| 375 | 375 | ||
| 376 | - [reportMount triggering ShadowTreeRegistry lock re-entry](../stability-fix-history/0.82-stability-fix-history-summary/02-application-freezes.md#ab0d11db7) | 376 | - [reportMount triggering ShadowTreeRegistry lock re-entry](../stability-fix-history/0.82-stability-fix-history-summary/02-application-freezes.md#ab0d11db7) |
| 377 | -- [getTurboModule hold lock create TM causing deadlock and freeze](../stability-fix-history/0.77-stability-fix-history-summary/02-application-freezes.md#a26036ba2) | 377 | +- [getTurboModule hold lock create TM causing deadlock and freeze](../stability-fix-history/0.77-stability-fix-history-summary/02-application-freezes.md#7420d467f) |
| 378 | 378 | ||
| 379 | ### 3.3 Each Type Operation Must Execute on Prescribed Thread | 379 | ### 3.3 Each Type Operation Must Execute on Prescribed Thread |
| 380 | 380 | ||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | This document summarizes historical fixes classified as application freezes in this version line, focusing on deadlocks, lock re-entry, cross-thread blocking, and wait chains that can make the application unresponsive. | 3 | This document summarizes historical fixes classified as application freezes in this version line, focusing on deadlocks, lock re-entry, cross-thread blocking, and wait chains that can make the application unresponsive. |
| 4 | 4 | ||
| 5 | -<a id="a26036ba2"></a> | 5 | +<a id="7420d467f"></a> |
| 6 | 6 | ||
| 7 | ### 1. Deadlock and freeze when getTurboModule creates a TM while holding a lock | 7 | ### 1. Deadlock and freeze when getTurboModule creates a TM while holding a lock |
| 8 | 8 | ||
| @@ -38,7 +38,7 @@ This document summarizes historical stability fixes on the 0.77 branch, organize | |||
| 38 | 38 | ||
| 39 | | # | Modification Date | Version | Issue Description | Affected Module | Issue Type | Commit / PR | Details | | 39 | | # | Modification Date | Version | Issue Description | Affected Module | Issue Type | Commit / PR | Details | |
| 40 | | --- | ----------------- | ------- | -------------------------------------------------------------------------- | ----------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | | 40 | | --- | ----------------- | ------- | -------------------------------------------------------------------------- | ----------------------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | |
| 41 | -| 1 | 2024-10-23 | 0.77.18 | Deadlock and freeze when getTurboModule creates a TM while holding a lock | TurboModuleProvider / TurboModule | Thread Blocking | [7420d467f](https://gitcode.com/CPF-RN/ohos_react_native/commit/7420d467f194330d18cbd658350c6c9c4605b130) | [View details](02-application-freezes.md#a26036ba2) | | 41 | +| 1 | 2024-10-23 | 0.77.18 | Deadlock and freeze when getTurboModule creates a TM while holding a lock | TurboModuleProvider / TurboModule | Thread Blocking | [7420d467f](https://gitcode.com/CPF-RN/ohos_react_native/commit/7420d467f194330d18cbd658350c6c9c4605b130) | [View details](02-application-freezes.md#7420d467f) | |
| 42 | | 2 | 2025-07-25 | 0.77.18 | Main-thread RNInstance destruction triggers deadlock detection and a crash | RNInstance / TurboModuleProvider / TurboModuleFactory | Thread Blocking | [d113ce259](https://gitcode.com/CPF-RN/ohos_react_native/commit/d113ce259e730387e6935db15565463376c5fd4a) / [!1297](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1297) | [View details](02-application-freezes.md#d113ce259) | | 42 | | 2 | 2025-07-25 | 0.77.18 | Main-thread RNInstance destruction triggers deadlock detection and a crash | RNInstance / TurboModuleProvider / TurboModuleFactory | Thread Blocking | [d113ce259](https://gitcode.com/CPF-RN/ohos_react_native/commit/d113ce259e730387e6935db15565463376c5fd4a) / [!1297](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1297) | [View details](02-application-freezes.md#d113ce259) | |
| 43 | | 3 | 2026-01-07 | 0.77.44 | FontRegistry deadlock caused by inconsistent lock ordering | FontRegistry | Thread Blocking | [278db7406](https://gitcode.com/CPF-RN/ohos_react_native/commit/278db74062eacf494c34cf66eb354ad44505fde5) / [!1984](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1984) | [View details](02-application-freezes.md#278db7406) | | 43 | | 3 | 2026-01-07 | 0.77.44 | FontRegistry deadlock caused by inconsistent lock ordering | FontRegistry | Thread Blocking | [278db7406](https://gitcode.com/CPF-RN/ohos_react_native/commit/278db74062eacf494c34cf66eb354ad44505fde5) / [!1984](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1984) | [View details](02-application-freezes.md#278db7406) | |
| 44 | | 4 | 2026-02-28 | 0.77.59 | ShadowTreeRegistry lock re-entry during reportMount | ShadowTreeRegistry | Thread Blocking | [d4db9af69](https://gitcode.com/CPF-RN/ohos_react_native/commit/d4db9af6902ac2a860e2265e6edc3367ae8be99c) / [!2283](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/2283) | [View details](02-application-freezes.md#d4db9af69) | | 44 | | 4 | 2026-02-28 | 0.77.59 | ShadowTreeRegistry lock re-entry during reportMount | ShadowTreeRegistry | Thread Blocking | [d4db9af69](https://gitcode.com/CPF-RN/ohos_react_native/commit/d4db9af6902ac2a860e2265e6edc3367ae8be99c) / [!2283](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/2283) | [View details](02-application-freezes.md#d4db9af69) | |
| @@ -8,6 +8,7 @@ This document provides guidance for two upgrade scenarios: | |||
| 8 | - [0.77.x → 0.82.x](#upgrading-from-077x-to-082x) | 8 | - [0.77.x → 0.82.x](#upgrading-from-077x-to-082x) |
| 9 | - [0.82.x → 0.84.x](#upgrading-from-082x-to-084x) | 9 | - [0.82.x → 0.84.x](#upgrading-from-082x-to-084x) |
| 10 | - [0.84.x → 0.86.x](#upgrading-from-084x-to-086x) | 10 | - [0.84.x → 0.86.x](#upgrading-from-084x-to-086x) |
| 11 | + - [0.86.x → 0.88.x](#upgrading-from-086x-to-088x) | ||
| 11 | 12 | ||
| 12 | # Minor Version Upgrade | 13 | # Minor Version Upgrade |
| 13 | 14 | ||
| @@ -161,6 +162,7 @@ This section provides guidance for different major version upgrade scenarios: | |||
| 161 | - [Upgrading from 0.77.x to 0.82.x](#upgrading-from-077x-to-082x) | 162 | - [Upgrading from 0.77.x to 0.82.x](#upgrading-from-077x-to-082x) |
| 162 | - [Upgrading from 0.82.x to 0.84.x](#upgrading-from-082x-to-084x) | 163 | - [Upgrading from 0.82.x to 0.84.x](#upgrading-from-082x-to-084x) |
| 163 | - [Upgrading from 0.84.x to 0.86.x](#upgrading-from-084x-to-086x) | 164 | - [Upgrading from 0.84.x to 0.86.x](#upgrading-from-084x-to-086x) |
| 165 | +- [Upgrading from 0.86.x to 0.88.x](#upgrading-from-086x-to-088x) | ||
| 164 | 166 | ||
| 165 | ## Upgrading from 0.72.x to 0.77.x | 167 | ## Upgrading from 0.72.x to 0.77.x |
| 166 | 168 | ||
| @@ -487,3 +489,77 @@ References: | |||
| 487 | - [AwesomeProject template changes from 0.84.1 to 0.86.3](https://react-native-community.github.io/upgrade-helper/?from=0.84.1&to=0.86.3) | 489 | - [AwesomeProject template changes from 0.84.1 to 0.86.3](https://react-native-community.github.io/upgrade-helper/?from=0.84.1&to=0.86.3) |
| 488 | - [React Native 0.86 release notes (no user-facing breaking changes)](https://reactnative.dev/blog/2026/06/11/react-native-0.86) | 490 | - [React Native 0.86 release notes (no user-facing breaking changes)](https://reactnative.dev/blog/2026/06/11/react-native-0.86) |
| 489 | - [Upstream community ChangeLog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md) | 491 | - [Upstream community ChangeLog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md) |
| 492 | + | ||
| 493 | +## Upgrading from 0.86.x to 0.88.x | ||
| 494 | + | ||
| 495 | +This section describes how to upgrade an RN project from **0.86.x** to **0.88.x**. | ||
| 496 | + | ||
| 497 | +> Note: This section covers upgrading an RN / RNOH project from **0.86.x** to **0.88.x**. After the dependency and project steps below, review app-side changes against the upstream 0.88 release notes and Upgrade Helper. Node.js **>= 22.11.0** is recommended. | ||
| 498 | + | ||
| 499 | +1. Upgrade RN project dependency versions | ||
| 500 | + - Known required dependency upgrades: | ||
| 501 | + ```json | ||
| 502 | + { | ||
| 503 | + ... | ||
| 504 | + "dependencies": { | ||
| 505 | + "react": "19.3.0", | ||
| 506 | + "react-native": "0.88.1" | ||
| 507 | + }, | ||
| 508 | + "devDependencies": { | ||
| 509 | + "@react-native-community/cli": "20.2.0", | ||
| 510 | + "@react-native/babel-preset": "0.88.1" | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + ``` | ||
| 514 | + - If any of the above are missing from the current 0.86 project, add them and keep versions exactly as listed | ||
| 515 | + - Upstream also bumped additional development dependencies; follow them optionally: | ||
| 516 | + ```json | ||
| 517 | + { | ||
| 518 | + ... | ||
| 519 | + "devDependencies": { | ||
| 520 | + "@babel/core": "^7.25.2", | ||
| 521 | + "@babel/preset-env": "^7.25.3", | ||
| 522 | + "@babel/runtime": "^7.25.0", | ||
| 523 | + "@react-native-community/cli": "20.2.0", | ||
| 524 | + "@react-native-community/cli-platform-android": "20.2.0", | ||
| 525 | + "@react-native-community/cli-platform-ios": "20.2.0", | ||
| 526 | + "@react-native/babel-preset": "0.88.1", | ||
| 527 | + "@react-native/eslint-config": "0.88.1", | ||
| 528 | + "@react-native/metro-config": "0.88.1", | ||
| 529 | + "@react-native/typescript-config": "0.88.1", | ||
| 530 | + "@types/jest": "^29.5.13", | ||
| 531 | + "@types/react": "^19.2.0", | ||
| 532 | + "@types/react-test-renderer": "^19.1.0", | ||
| 533 | + "eslint": "^8.19.0", | ||
| 534 | + "jest": "^29.6.3", | ||
| 535 | + "prettier": "2.8.8", | ||
| 536 | + "react-test-renderer": "19.3.0", | ||
| 537 | + "typescript": "^5.8.3" | ||
| 538 | + } | ||
| 539 | + } | ||
| 540 | + ``` | ||
| 541 | + - Tip: In VS Code, paste the full `devDependencies` block into the target project; duplicate keys are underlined—delete the old ones to finish the upgrade | ||
| 542 | +2. After upgrading/adding RNOH frontend dependencies, run `npm i`. If dependency conflicts occur, adjust versions in `package.json` based on the error messages | ||
| 543 | + - Upgrade dependencies: `"react-native-harmony"` or `"@xxx/react-native-harmony"` to `0.88.1` | ||
| 544 | + > Keep the original package name/scope. Do not add an organization prefix if the project did not previously use one. | ||
| 545 | + - Upgrade devDependencies: `"@react-native-oh/react-native-harmony-cli"` to `0.88.1` | ||
| 546 | + - For exact versions, see the [RNOH roadmap](../06-community/roadmap.md) | ||
| 547 | +3. Review and update configuration files | ||
| 548 | + 1. `babel.config.js` | ||
| 549 | + - Confirm `presets` uses `'module:@react-native/babel-preset'` | ||
| 550 | + ```jsx | ||
| 551 | + module.exports = { | ||
| 552 | + presets: ["module:@react-native/babel-preset"], | ||
| 553 | + }; | ||
| 554 | + ``` | ||
| 555 | +4. Run `npm run dev` (or `npx react-native bundle-harmony --dev`) to regenerate `harmony/entry/src/main/resources/rawfile/bundle.harmony.js` and its `assets` directory. Re-sync/rebuild the HarmonyOS project after the bundle is regenerated. If dependency conflicts occur, adjust `package.json`, `metro.config.js`, `babel.config.js`, and related configs based on the error output | ||
| 556 | +5. Update `@rnoh/react-native-openharmony` in all HarmonyOS `oh-package.json5` files (for example to `0.88.1`); see the [RNOH roadmap](../06-community/roadmap.md) | ||
| 557 | +6. Run `ohpm i` in the HarmonyOS project, or click `File > Sync and Refresh Project` in DevEco Studio | ||
| 558 | +7. Build the HAP, install, and validate | ||
| 559 | + | ||
| 560 | +References: | ||
| 561 | + | ||
| 562 | +- [AwesomeProject template changes from 0.86.3 to 0.88.1](https://react-native-community.github.io/upgrade-helper/?from=0.86.3&to=0.88.1) | ||
| 563 | +- [React Native 0.88 release notes](https://reactnative.dev/blog/2026/10/19/react-native-0.88) | ||
| 564 | +- [Strict TypeScript API](https://reactnative.dev/docs/strict-typescript-api) | ||
| 565 | +- [Upstream community ChangeLog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md) | ||
| @@ -20,7 +20,7 @@ | |||
| 20 | ### 1.1 Background | 20 | ### 1.1 Background |
| 21 | 21 | ||
| 22 | - **Organization migration**: With the establishment of the RN SIG, the RNOH repository moved to the independent `CPF-RN` organization. | 22 | - **Organization migration**: With the establishment of the RN SIG, the RNOH repository moved to the independent `CPF-RN` organization. |
| 23 | -- **Parallel versions**: Maintained versions (0.72, 0.77, and 0.82) coexist with an exploratory version (0.84). | 23 | +- **Parallel versions**: Maintained versions (0.72, 0.77, 0.82, and 0.84) coexist with the current adaptation branch (`0.88-preview`); the default `main` branch is the version-evolution baseline. |
| 24 | - **Governance**: Clear, practical branch governance is required. | 24 | - **Governance**: Clear, practical branch governance is required. |
| 25 | 25 | ||
| 26 | ### 1.2 Goals | 26 | ### 1.2 Goals |
| @@ -39,7 +39,9 @@ | |||
| 39 | **Mainline development with maintenance of multiple versions** | 39 | **Mainline development with maintenance of multiple versions** |
| 40 | 40 | ||
| 41 | ```text | 41 | ```text |
| 42 | -main (exploratory) | 42 | +0.88-preview (0.88 adaptation in progress) |
| 43 | + ↓ (merge back when ready) | ||
| 44 | +main (version evolution) | ||
| 43 | ↓ | 45 | ↓ |
| 44 | 0.82-main ← 0.82-feature/* ← developers | 46 | 0.82-main ← 0.82-feature/* ← developers |
| 45 | ↓ cherry-pick | 47 | ↓ cherry-pick |
| @@ -48,19 +50,19 @@ main (exploratory) | |||
| 48 | 50 | ||
| 49 | ### 2.2 Branch Structure | 51 | ### 2.2 Branch Structure |
| 50 | 52 | ||
| 51 | -| Branch type | Naming convention | Purpose | | 53 | +| Branch type | Naming convention | Purpose | |
| 52 | -| -------------------------- | --------------------------- | ------------------------------------------------------------- | | 54 | +| -------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------- | |
| 53 | -| Mainline | `main` | Next-generation exploratory development (0.84) | | 55 | +| Mainline | `main` | Version evolution baseline (use a published `0.XX-stable` dist-tag for production) | |
| 54 | -| Version development branch | `${version}-main` | Daily development and feature iteration for that version | | 56 | +| Version development branch | `${version}-main` | Daily development and feature iteration for that version | |
| 55 | -| Commercial release branch | `${version}-stable` | Commercial delivery; critical fixes only | | 57 | +| Commercial release branch | `${version}-stable` | Commercial delivery; critical fixes only | |
| 56 | -| Feature branch | `${version}-feature/<name>` | Isolated development of major features | | 58 | +| Feature branch | `${version}-feature/<name>` | Isolated development of major features | |
| 57 | -| Hotfix branch (optional) | `${version}-hotfix/<issue>` | Urgent fixes merged into the development and release branches | | 59 | +| Hotfix branch (optional) | `${version}-hotfix/<issue>` | Urgent fixes merged into the development and release branches | |
| 58 | 60 | ||
| 59 | ### 2.3 Core Principles | 61 | ### 2.3 Core Principles |
| 60 | 62 | ||
| 61 | 1. **One-way flow**: Feature branch → version development branch → release branch through cherry-picking. | 63 | 1. **One-way flow**: Feature branch → version development branch → release branch through cherry-picking. |
| 62 | 2. **Stable releases**: Create a release branch when the version development branch is stable. | 64 | 2. **Stable releases**: Create a release branch when the version development branch is stable. |
| 63 | -3. **Isolate exploration**: Do not merge `main` directly into production versions. | 65 | +3. **Isolate the baseline**: `main` is the latest evolution baseline and is not production-stable; use the matching `-stable` branch / npm dist-tag for production. |
| 64 | 4. **Synchronize fixes**: Fixes exclusive to a release branch must also be applied to its development branch. | 66 | 4. **Synchronize fixes**: Fixes exclusive to a release branch must also be applied to its development branch. |
| 65 | 67 | ||
| 66 | --- | 68 | --- |
| @@ -69,8 +71,8 @@ main (exploratory) | |||
| 69 | 71 | ||
| 70 | ### 3.1 Mainline: main | 72 | ### 3.1 Mainline: main |
| 71 | 73 | ||
| 72 | -- **Purpose**: Next-generation exploratory development (0.84). | 74 | +- **Purpose**: Current-line evolution baseline (now used for 0.88 upgrades and docs sync). |
| 73 | -- **Characteristics**: Stability is not guaranteed; experimental changes are allowed. | 75 | +- **Characteristics**: Continuously evolving; not production-stable; accepts new-version adaptation changes. |
| 74 | - **Permissions**: Maintainers can merge. | 76 | - **Permissions**: Maintainers can merge. |
| 75 | - **Protection rules**: | 77 | - **Protection rules**: |
| 76 | - CI checks must pass. | 78 | - CI checks must pass. |
| @@ -128,12 +130,13 @@ main (exploratory) | |||
| 128 | 130 | ||
| 129 | ### 4.1 Branch Mapping | 131 | ### 4.1 Branch Mapping |
| 130 | 132 | ||
| 131 | -| Version | Development branch | Commercial release branch | | 133 | +| Version | Development branch | Commercial release branch | |
| 132 | -| ----------- | ------------------ | ------------------------- | | 134 | +| ------- | ------------------ | ------------------------- | |
| 133 | -| 0.72 | `0.72-main` | `0.72-stable` | | 135 | +| 0.72 | `0.72-main` | `0.72-stable` | |
| 134 | -| 0.77 | `0.77-main` | `0.77-stable` | | 136 | +| 0.77 | `0.77-main` | `0.77-stable` | |
| 135 | -| 0.82 | `0.82-main` | `0.82-stable` | | 137 | +| 0.82 | `0.82-main` | `0.82-stable` | |
| 136 | -| Exploratory | `main` | — | | 138 | +| 0.84 | `0.84-main` | `0.84-stable` | |
| 139 | +| 0.88 | `0.88-preview` | — | | ||
| 137 | 140 | ||
| 138 | ## 5. Branch Operations | 141 | ## 5. Branch Operations |
| 139 | 142 | ||
| @@ -242,12 +245,13 @@ main (exploratory) | |||
| 242 | 245 | ||
| 243 | ### 6.1 Maintenance Matrix | 246 | ### 6.1 Maintenance Matrix |
| 244 | 247 | ||
| 245 | -| Version | Development branch maintenance | Release branch maintenance | Status | | 248 | +| Version | Development branch maintenance | Release branch maintenance | Status | |
| 246 | -| ------- | ------------------------------------------------- | ------------------------------------- | --------------------- | | 249 | +| --------------------- | ---------------------------------------- | ------------------------------------- | ------------------------------------------------- | |
| 247 | -| 0.72 | Security patches and critical defects | Security patches and critical defects | Long-term maintenance | | 250 | +| 0.72 | Security patches and critical defects | Security patches and critical defects | Long-term maintenance | |
| 248 | -| 0.77 | Active maintenance; new features accepted | Synchronized updates | Primary version | | 251 | +| 0.77 | Active maintenance; new features accepted | Synchronized updates | Primary version | |
| 249 | -| 0.82 | Active maintenance; new features accepted | Synchronized updates | Primary version | | 252 | +| 0.82 | Active maintenance; new features accepted | Synchronized updates | Primary version | |
| 250 | -| main | Exploratory development; stability not guaranteed | — | Under exploration | | 253 | +| 0.84 | Active maintenance; new features accepted | Synchronized updates | Release in progress (npm currently has `0.84-rc`) | |
| 254 | +| 0.88 / `0.88-preview` | Adaptation in progress on `0.88-preview` | — | Adaptation in progress | | ||
| 251 | 255 | ||
| 252 | ### 6.2 Version Evolution Rules | 256 | ### 6.2 Version Evolution Rules |
| 253 | 257 | ||
| @@ -304,20 +308,20 @@ main (exploratory) | |||
| 304 | 308 | ||
| 305 | - Daily development: Fork the repository, develop and verify in your fork, then merge back into `-main`. | 309 | - Daily development: Fork the repository, develop and verify in your fork, then merge back into `-main`. |
| 306 | - Release fixes: Merge into `-main` first, verify, then cherry-pick into `-stable`. | 310 | - Release fixes: Merge into `-main` first, verify, then cherry-pick into `-stable`. |
| 307 | -- Exploratory work for a new version: Use `main`. | 311 | +- 0.88 adaptation and docs sync: Use `0.88-preview`. |
| 308 | 312 | ||
| 309 | ### Q2: What If Multiple Versions Need the Same Fix? | 313 | ### Q2: What If Multiple Versions Need the Same Fix? |
| 310 | 314 | ||
| 311 | **A**: | 315 | **A**: |
| 312 | 316 | ||
| 313 | -1. Merge into the newest development branch first, such as `0.82-main`. | 317 | +1. Merge into the newest development branch first (currently `0.88-preview` for 0.88 work, or the target `0.XX-main`). |
| 314 | 2. Cherry-pick into other versions' `-main` branches as needed. | 318 | 2. Cherry-pick into other versions' `-main` branches as needed. |
| 315 | 3. For releases, cherry-pick into the corresponding `-stable` branches. | 319 | 3. For releases, cherry-pick into the corresponding `-stable` branches. |
| 316 | 4. Record the fix's commit hash and affected versions. | 320 | 4. Record the fix's commit hash and affected versions. |
| 317 | 321 | ||
| 318 | -### Q3: Can main Be Merged Directly into 0.82-main? | 322 | +### Q3: Can `0.88-preview` Be Merged Directly into Older Version Lines? |
| 319 | 323 | ||
| 320 | -**A**: No. `main` is for exploration. To bring a change into a production version: | 324 | +**A**: No. `0.88-preview` is the 0.88 adaptation branch. To bring a change into an existing production line such as `0.82-main` or `0.84-main`: |
| 321 | 325 | ||
| 322 | - Reimplement it on a feature branch based on the corresponding development branch. | 326 | - Reimplement it on a feature branch based on the corresponding development branch. |
| 323 | - Alternatively, cherry-pick selected stable changes. | 327 | - Alternatively, cherry-pick selected stable changes. |
| @@ -502,7 +502,7 @@ Follow the [Branch Management Guidelines](./branch-management.md). | |||
| 502 | 502 | ||
| 503 | | Branch type | Naming convention | Purpose | | 503 | | Branch type | Naming convention | Purpose | |
| 504 | | -------------------------- | --------------------------- | --------------------------------------------------------- | | 504 | | -------------------------- | --------------------------- | --------------------------------------------------------- | |
| 505 | -| Mainline | `main` | Next-generation exploratory development (0.84) | | 505 | +| Mainline | `main` | Current-line evolution baseline (now 0.88) | |
| 506 | | Version development branch | `${version}-main` | Daily development and feature iteration for the version | | 506 | | Version development branch | `${version}-main` | Daily development and feature iteration for the version | |
| 507 | | Commercial release branch | `${version}-stable` | Commercial delivery; critical fixes only | | 507 | | Commercial release branch | `${version}-stable` | Commercial delivery; critical fixes only | |
| 508 | | Feature branch | `${version}-feature/<name>` | Isolated development of major features | | 508 | | Feature branch | `${version}-feature/<name>` | Isolated development of major features | |
| @@ -525,7 +525,7 @@ Follow the [Branch Management Guidelines](./branch-management.md). | |||
| 525 | 525 | ||
| 526 | If multiple versions need the same fix: | 526 | If multiple versions need the same fix: |
| 527 | 527 | ||
| 528 | -1. Merge into the newest development branch first, such as `0.82-main`. | 528 | +1. Merge into the newest development branch first (currently `main` / 0.88, or the target `0.XX-main`). |
| 529 | 2. Cherry-pick into other versions' `-main` branches based on the affected scope. | 529 | 2. Cherry-pick into other versions' `-main` branches based on the affected scope. |
| 530 | 3. For releases, cherry-pick into the corresponding `-stable` branches. | 530 | 3. For releases, cherry-pick into the corresponding `-stable` branches. |
| 531 | 4. Record the fix's commit hash and affected scope. | 531 | 4. Record the fix's commit hash and affected scope. |
| @@ -452,7 +452,7 @@ body: | |||
| 452 | attributes: | 452 | attributes: |
| 453 | label: React Native OpenHarmony version | 453 | label: React Native OpenHarmony version |
| 454 | description: Provide the React Native OpenHarmony version you are using. | 454 | description: Provide the React Native OpenHarmony version you are using. |
| 455 | - placeholder: "0.86.1" | 455 | + placeholder: "0.88.1" |
| 456 | validations: | 456 | validations: |
| 457 | required: true | 457 | required: true |
| 458 | - type: textarea | 458 | - type: textarea |
| @@ -517,7 +517,7 @@ body: | |||
| 517 | attributes: | 517 | attributes: |
| 518 | label: React Native OpenHarmony version | 518 | label: React Native OpenHarmony version |
| 519 | description: Provide the React Native OpenHarmony version you are using. | 519 | description: Provide the React Native OpenHarmony version you are using. |
| 520 | - placeholder: "0.86.1" | 520 | + placeholder: "0.88.1" |
| 521 | validations: | 521 | validations: |
| 522 | required: true | 522 | required: true |
| 523 | - type: textarea | 523 | - type: textarea |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | | Item | Description | | 3 | | Item | Description | |
| 4 | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 4 | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 5 | -| **Scope** | Official releases and prereleases across RNOH version lines (0.72 / 0.77 / 0.82 / 0.84 / 0.86 …) | | 5 | +| **Scope** | Official releases and prereleases across RNOH version lines (0.72 / 0.77 / 0.82 / 0.84 / 0.86 / 0.88 …) | |
| 6 | | **Files to archive** | Symbol files (`.sym`) for RNOH-built and prebuilt `.so` libraries in Release HAR packages | | 6 | | **Files to archive** | Symbol files (`.sym`) for RNOH-built and prebuilt `.so` libraries in Release HAR packages | |
| 7 | | **Archive location** | The corresponding version's Release page in the main RNOH repository on GitCode (attachments and a symbol link table in the release description) | | 7 | | **Archive location** | The corresponding version's Release page in the main RNOH repository on GitCode (attachments and a symbol link table in the release description) | |
| 8 | | **Matching key** | ELF BuildID | | 8 | | **Matching key** | ELF BuildID | |
| @@ -84,7 +84,7 @@ rnoh-symbols-[RNOH-version]-[build-configuration].tar.gz | |||
| 84 | Example: | 84 | Example: |
| 85 | 85 | ||
| 86 | ```text | 86 | ```text |
| 87 | -rnoh-symbols-0.86.1-release.tar.gz | 87 | +rnoh-symbols-0.88.1-release.tar.gz |
| 88 | ``` | 88 | ``` |
| 89 | 89 | ||
| 90 | ### 2. Archive Structure | 90 | ### 2. Archive Structure |
| @@ -92,7 +92,7 @@ rnoh-symbols-0.86.1-release.tar.gz | |||
| 92 | Currently, only arm64-v8a is supported, and symbol files are stored in a flat layout. Once x86_64 builds are enabled, organize the files into architecture-specific subdirectories. | 92 | Currently, only arm64-v8a is supported, and symbol files are stored in a flat layout. Once x86_64 builds are enabled, organize the files into architecture-specific subdirectories. |
| 93 | 93 | ||
| 94 | ```text | 94 | ```text |
| 95 | -rnoh-symbols-0.86.1-release.tar.gz | 95 | +rnoh-symbols-0.88.1-release.tar.gz |
| 96 | ├── libhermestooling.so.sym | 96 | ├── libhermestooling.so.sym |
| 97 | ├── libhermesvm.so.sym | 97 | ├── libhermesvm.so.sym |
| 98 | ├── libjsi.so.sym | 98 | ├── libjsi.so.sym |
| @@ -120,20 +120,21 @@ The Release description must include a symbol link table (following the upstream | |||
| 120 | ```markdown | 120 | ```markdown |
| 121 | RNOH Symbols: | 121 | RNOH Symbols: |
| 122 | 122 | ||
| 123 | -- Release: rnoh-symbols-0.86.1-release.tar.gz (covers release.har and release2.har) | 123 | +- Release: rnoh-symbols-0.88.1-release.tar.gz |
| 124 | +- Release2: rnoh-symbols-0.88.1-release2.tar.gz (native build differs from release; archived separately) | ||
| 124 | - Debug: Not archived (partners compile the source package themselves; symbols are self-contained) | 125 | - Debug: Not archived (partners compile the source package themselves; symbols are self-contained) |
| 125 | 126 | ||
| 126 | | Module | BuildID | | 127 | | Module | BuildID | |
| 127 | | ----------------------- | ---------------------------------------- | | 128 | | ----------------------- | ---------------------------------------- | |
| 128 | -| libhermestooling.so | 0426452f9714d449fef5df1d8c9d647aa3418fb9 | | 129 | +| libhermestooling.so | 8948dacdd6411f70c4202b527c558ea891044c86 | |
| 129 | -| libhermesvm.so | c09dd5a82a16e41f1cb5a9c3abc42925286cf48e | | 130 | +| libhermesvm.so | 9ba68b4dd3f8c3cdb7092cb93e02f984b8507e70 | |
| 130 | -| libjsi.so | 1ee871fa7f3cc9f370faafb1a8d604569142955b | | 131 | +| libjsi.so | 35e3ff21c3c7290b160e51531257d01486f329c6 | |
| 131 | -| libjsvmtooling.so | b147bae673b816363f85aa992dccbe7acf1b807f | | 132 | +| libjsvmtooling.so | 84324e5061f93b4e0f6880880e61f8157a34a651 | |
| 132 | -| libreactnative.so | 690f4aa51053e41bb7ab308316124637fc315e94 | | 133 | +| libreactnative.so | 847e6259560549acfd40ec567f2b4fb8681d849c | |
| 133 | -| librnoh_core.so | 51daea39d125a3934d8d704e548bdc50b3371015 | | 134 | +| librnoh_core.so | fc83d55f3fb09938d488404867cf1ceb9db69fe1 | |
| 134 | -| librnoh_core_package.so | 12f2fa2cc882a7e9a6c9548d9dcfdc3596648723 | | 135 | +| librnoh_core_package.so | c0566be85bcc9094be044e12969eee9db0b395a7 | |
| 135 | 136 | ||
| 136 | -> Hermes: 250829098.0.17 / 3477757eb2475555cf8d8df24bfb1deb0613880d (for RN 0.86.3; built independently by RNOH, with a different BuildID from upstream; upstream symbols cannot be used as a substitute) | 137 | +> Hermes: 260318099.0.5 / 9a115f15785851f4ff2747ebb090ddd066fc8ad2 (for RN 0.88.1; built independently by RNOH, with a different BuildID from upstream; upstream symbols cannot be used as a substitute) |
| 137 | ``` | 138 | ``` |
| 138 | 139 | ||
| 139 | **Notes**: | 140 | **Notes**: |
| @@ -52,7 +52,7 @@ Each document must include the following metadata: | |||
| 52 | ```markdown | 52 | ```markdown |
| 53 | # Document Title | 53 | # Document Title |
| 54 | 54 | ||
| 55 | -> Applicable versions: v0.72 / v0.77 / v0.82 / v0.84 / v0.86 (required for version-related docs) | 55 | +> Applicable versions: v0.72 / v0.77 / v0.82 / v0.84 / v0.86 / v0.88 (required for version-related docs) |
| 56 | > Developer Journey: Design / Development / Debugging / Optimization / Testing / Operations | 56 | > Developer Journey: Design / Development / Debugging / Optimization / Testing / Operations |
| 57 | > Last updated: YYYY-MM-DD | 57 | > Last updated: YYYY-MM-DD |
| 58 | > Contributors: @username | 58 | > Contributors: @username |
| @@ -65,6 +65,28 @@ timeline | |||
| 65 | 65 | ||
| 66 | ### Version Features | 66 | ### Version Features |
| 67 | 67 | ||
| 68 | +> 0.88.x | ||
| 69 | + | ||
| 70 | +- _[Web-based event dispatching](https://reactnative.dev/blog/2026/10/19/react-native-0.88#web-based-event-dispatching)_ | ||
| 71 | + Events are dispatched through the W3C `EventTarget` path by default (capture/bubble), aligning with the web event model. Public event props remain compatible; there are no user-facing breaking changes. | ||
| 72 | +- _[Variable fonts with fontVariationSettings](https://reactnative.dev/blog/2026/10/19/react-native-0.88#variable-fonts-with-fontvariationsettings)_ | ||
| 73 | + `Text` / `TextInput` support `fontVariationSettings` (object or CSS string form) for variable-font axis control. | ||
| 74 | +- _[SceneDelegate lifecycle support on iOS](https://reactnative.dev/blog/2026/10/19/react-native-0.88#ios-scenedelegate-support)_ | ||
| 75 | + Adds iOS `SceneDelegate` lifecycle support (single scene) for the UIScene requirement. | ||
| 76 | +- _[ArrayBuffer for Java TurboModules](https://reactnative.dev/blog/2026/10/19/react-native-0.88#arraybuffer-for-java-turbomodules)_ | ||
| 77 | + Java TurboModules can take and return JS `ArrayBuffer` directly, avoiding binary encode/decode overhead. | ||
| 78 | +- _[Experimental Swift Package Manager support](https://reactnative.dev/blog/2026/10/19/react-native-0.88#experimental-swift-package-manager-support)_ | ||
| 79 | + Continues hardening experimental SwiftPM support; dependency baseline moves to React 19.3.0 and Metro 0.87. | ||
| 80 | + | ||
| 81 | +> 0.86.x | ||
| 82 | + | ||
| 83 | +- _[Edge-to-Edge on Android](https://reactnative.dev/blog/2026/06/11/react-native-0.86#edge-to-edge-on-android)_ | ||
| 84 | + Comprehensive Android 15+ edge-to-edge fixes (`measureInWindow`, `KeyboardAvoidingView`, `Dimensions`, `StatusBar`, and more). | ||
| 85 | +- _[React Native DevTools Improvements](https://reactnative.dev/blog/2026/06/11/react-native-0.86#react-native-devtools-improvements)_ | ||
| 86 | + DevTools supports light/dark mode emulation via `Emulation.setEmulatedMedia`. | ||
| 87 | +- _[No user-facing breaking changes](https://reactnative.dev/blog/2026/06/11/react-native-0.86#breaking-changes)_ | ||
| 88 | + Following 0.83, another release with no user-facing breaking changes. | ||
| 89 | + | ||
| 68 | > 0.84.x | 90 | > 0.84.x |
| 69 | 91 | ||
| 70 | - _[Hermes V1 as Default](https://reactnative.dev/blog/2026/02/11/react-native-0.84#hermes-v1-as-default)_ | 92 | - _[Hermes V1 as Default](https://reactnative.dev/blog/2026/02/11/react-native-0.84#hermes-v1-as-default)_ |
| @@ -11,28 +11,29 @@ | |||
| 11 | "dev": "react-native bundle-harmony --dev" | 11 | "dev": "react-native bundle-harmony --dev" |
| 12 | }, | 12 | }, |
| 13 | "dependencies": { | 13 | "dependencies": { |
| 14 | - "react": "19.2.3", | 14 | + "@react-native-oh/react-native-harmony": "0.88.1", |
| 15 | - "react-native": "0.84.1" | 15 | + "react": "19.3.0", |
| 16 | + "react-native": "0.88.1" | ||
| 16 | }, | 17 | }, |
| 17 | "devDependencies": { | 18 | "devDependencies": { |
| 18 | "@babel/core": "^7.25.2", | 19 | "@babel/core": "^7.25.2", |
| 19 | "@babel/preset-env": "^7.25.3", | 20 | "@babel/preset-env": "^7.25.3", |
| 20 | "@babel/runtime": "^7.25.0", | 21 | "@babel/runtime": "^7.25.0", |
| 21 | - "@react-native-community/cli": "20.1.0", | 22 | + "@react-native-community/cli": "20.2.0", |
| 22 | - "@react-native-community/cli-platform-android": "20.1.0", | 23 | + "@react-native-community/cli-platform-android": "20.2.0", |
| 23 | - "@react-native-community/cli-platform-ios": "20.1.0", | 24 | + "@react-native-community/cli-platform-ios": "20.2.0", |
| 24 | - "@react-native-oh/react-native-harmony-cli": "0.84.1", | 25 | + "@react-native-oh/react-native-harmony-cli": "0.88.1", |
| 25 | - "@react-native/babel-preset": "0.84.1", | 26 | + "@react-native/babel-preset": "0.88.1", |
| 26 | - "@react-native/eslint-config": "0.84.1", | 27 | + "@react-native/eslint-config": "0.88.1", |
| 27 | - "@react-native/metro-config": "0.84.1", | 28 | + "@react-native/metro-config": "0.88.1", |
| 28 | - "@react-native/typescript-config": "0.84.1", | 29 | + "@react-native/typescript-config": "0.88.1", |
| 29 | "@types/jest": "^29.5.13", | 30 | "@types/jest": "^29.5.13", |
| 30 | "@types/react": "^19.2.0", | 31 | "@types/react": "^19.2.0", |
| 31 | - "@types/react-test-renderer": "^19.2.0", | 32 | + "@types/react-test-renderer": "^19.1.0", |
| 32 | "eslint": "^8.19.0", | 33 | "eslint": "^8.19.0", |
| 33 | "jest": "^29.6.3", | 34 | "jest": "^29.6.3", |
| 34 | "prettier": "2.8.8", | 35 | "prettier": "2.8.8", |
| 35 | - "react-test-renderer": "19.2.3", | 36 | + "react-test-renderer": "19.3.0", |
| 36 | "typescript": "^5.8.3" | 37 | "typescript": "^5.8.3" |
| 37 | }, | 38 | }, |
| 38 | "engines": { | 39 | "engines": { |
| @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.4.1) | |||
| 3 | set(CMAKE_SKIP_BUILD_RPATH TRUE) | 3 | set(CMAKE_SKIP_BUILD_RPATH TRUE) |
| 4 | set(NATIVERENDER_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}") | 4 | set(NATIVERENDER_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}") |
| 5 | set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") | 5 | set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules") |
| 6 | -set(RNOH_CPP_DIR "${OH_MODULE_DIR}/@rnoh/react-native-openharmony/src/main/include") | 6 | +set(RNOH_CPP_DIR "${OH_MODULE_DIR}/@rnoh/react-native-openharmony/include") |
| 7 | set(REACT_COMMON_PATCH_DIR "${RNOH_CPP_DIR}/patches/react_native_core") | 7 | set(REACT_COMMON_PATCH_DIR "${RNOH_CPP_DIR}/patches/react_native_core") |
| 8 | 8 | ||
| 9 | set(CMAKE_CXX_STANDARD 17) | 9 | set(CMAKE_CXX_STANDARD 17) |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ## js给native发消息 | 3 | ## js给native发消息 |
| 4 | 4 | ||
| 5 | -js 给 native 发消息需要用到[TurboModule](https://reactnative.cn/docs/0.86/turbo-native-modules-introduction)模块,如果您想实现自己的 TurboModule,可以参考[自定义TurboModule](../02-开发/02-开发指南/TurboModule.md)。 | 5 | +js 给 native 发消息需要用到[TurboModule](https://reactnative.cn/docs/0.88/turbo-native-modules-introduction)模块,如果您想实现自己的 TurboModule,可以参考[自定义TurboModule](../02-开发/02-开发指南/TurboModule.md)。 |
| 6 | 6 | ||
| 7 | ## native给js发消息 | 7 | ## native给js发消息 |
| 8 | 8 | ||
| @@ -53,31 +53,34 @@ | |||
| 53 | 53 | ||
| 54 | - 鸿蒙 PC 环境变量设置方法: | 54 | - 鸿蒙 PC 环境变量设置方法: |
| 55 | 55 | ||
| 56 | - 鸿蒙 PC 上的 hdc 由系统 HNP 包 `hmos-clt` 提供,位于 `/data/service/hnp/hmos-clt.org/hmos-clt_x.x.x/sdk/default/openharmony/toolchains`。配置方法如下: | 56 | + 鸿蒙 PC 上的 hdc 由系统 HNP 包 `hmos-clt` 提供,位于 `/data/service/hnp/hmos-clt.org/hmos-clt_x.x.x/sdk/default/openharmony/toolchains`。配置方法如下: |
| 57 | 57 | ||
| 58 | - a. 打开终端,执行以下命令,打开 `.zshrc` 文件。 | 58 | + a. 打开终端,执行以下命令,打开 `.zshrc` 文件。 |
| 59 | 59 | ||
| 60 | - ```bash | 60 | + ```bash |
| 61 | - vim ~/.zshrc | 61 | + vim ~/.zshrc |
| 62 | - ``` | 62 | + ``` |
| 63 | 63 | ||
| 64 | - 输入以下内容,在 PATH 路径下添加 HDC 工具路径(路径中的版本号 `hmos-clt_1.0.0` 以本机实际安装版本为准): | 64 | + 输入以下内容,在 PATH 路径下添加 HDC 工具路径(路径中的版本号 `hmos-clt_1.0.0` 以本机实际安装版本为准): |
| 65 | - ```bash | ||
| 66 | - export PATH=$PATH:/data/service/hnp/hmos-clt.org/hmos-clt_1.0.0/sdk/default/openharmony/toolchains | ||
| 67 | - ``` | ||
| 68 | 65 | ||
| 69 | - 执行以下命令使配置的环境变量生效(或新开一个终端): | 66 | + ```bash |
| 70 | - ```bash | 67 | + export PATH=$PATH:/data/service/hnp/hmos-clt.org/hmos-clt_1.0.0/sdk/default/openharmony/toolchains |
| 71 | - source ~/.zshrc | 68 | + ``` |
| 72 | - ``` | ||
| 73 | 69 | ||
| 74 | - 执行以下命令验证 hdc 可用: | 70 | + 执行以下命令使配置的环境变量生效(或新开一个终端): |
| 75 | - ```bash | ||
| 76 | - hdc -v | ||
| 77 | - hdc list targets | ||
| 78 | - ``` | ||
| 79 | 71 | ||
| 80 | - 实测未设置 `HDC_SERVER_PORT` 时 hdc 服务亦可正常工作;如遇端口冲突,可在 `~/.zshrc` 中添加 `export HDC_SERVER_PORT=7035`。 | 72 | + ```bash |
| 73 | + source ~/.zshrc | ||
| 74 | + ``` | ||
| 75 | + | ||
| 76 | + 执行以下命令验证 hdc 可用: | ||
| 77 | + | ||
| 78 | + ```bash | ||
| 79 | + hdc -v | ||
| 80 | + hdc list targets | ||
| 81 | + ``` | ||
| 82 | + | ||
| 83 | + 实测未设置 `HDC_SERVER_PORT` 时 hdc 服务亦可正常工作;如遇端口冲突,可在 `~/.zshrc` 中添加 `export HDC_SERVER_PORT=7035`。 | ||
| 81 | 84 | ||
| 82 | 5. <span id="set_capi_path">配置 CAPI 版本环境变量</span> | 85 | 5. <span id="set_capi_path">配置 CAPI 版本环境变量</span> |
| 83 | 86 | ||
| @@ -123,15 +126,15 @@ | |||
| 123 | 126 | ||
| 124 | - 鸿蒙 PC 环境: | 127 | - 鸿蒙 PC 环境: |
| 125 | 128 | ||
| 126 | - 鸿蒙 PC 默认 shell 为 zsh,将环境变量写入 `~/.zshrc` 即可: | 129 | + 鸿蒙 PC 默认 shell 为 zsh,将环境变量写入 `~/.zshrc` 即可: |
| 127 | 130 | ||
| 128 | - ```bash | 131 | + ```bash |
| 129 | - echo 'export RNOH_C_API_ARCH=1' >> ~/.zshrc | 132 | + echo 'export RNOH_C_API_ARCH=1' >> ~/.zshrc |
| 130 | - source ~/.zshrc | 133 | + source ~/.zshrc |
| 131 | - echo $RNOH_C_API_ARCH | 134 | + echo $RNOH_C_API_ARCH |
| 132 | - ``` | 135 | + ``` |
| 133 | 136 | ||
| 134 | - 如果输出为 1,则表示环境变量已成功设置。 | 137 | + 如果输出为 1,则表示环境变量已成功设置。 |
| 135 | 138 | ||
| 136 | 6. 编辑用户级 .npmrc 配置文件 | 139 | 6. 编辑用户级 .npmrc 配置文件 |
| 137 | 140 | ||
| @@ -166,41 +169,41 @@ | |||
| 166 | 169 | ||
| 167 | a. 工具链安装与检查。 | 170 | a. 工具链安装与检查。 |
| 168 | 171 | ||
| 169 | - 鸿蒙 PC 默认 shell 为 zsh(配置文件 `~/.zshrc`),但是目前版本系统默认不带 Harmonybrew。需要先安装 Harmonybrew。Node.js / npm 及 C++ 侧构建工具(git、cmake、ninja)通过 Harmonybrew 安装,Harmonybrew 当前提供的 node 版本为 22.11.0: | 172 | + 鸿蒙 PC 默认 shell 为 zsh(配置文件 `~/.zshrc`),但是目前版本系统默认不带 Harmonybrew。需要先安装 Harmonybrew。Node.js / npm 及 C++ 侧构建工具(git、cmake、ninja)通过 Harmonybrew 安装。RN 0.88 升级模板使用 Node.js 22.11.0 或更高版本,安装后执行 `node --version` 核对: |
| 170 | 173 | ||
| 171 | - 先查看系统是否安装Harmonybrew: | 174 | - 先查看系统是否安装Harmonybrew: |
| 172 | 175 | ||
| 173 | - 终端执行 `brew --version`,如果报错“command not found: brew”,则系统未安装 Harmonybrew,需自行安装,安装步骤如下: | 176 | + 终端执行 `brew --version`,如果报错“command not found: brew”,则系统未安装 Harmonybrew,需自行安装,安装步骤如下: |
| 174 | 177 | ||
| 175 | - 1、 打开【开发者选项】 | 178 | + 1、 打开【开发者选项】 |
| 176 | 179 | ||
| 177 | - 2、 设置 → 隐私和安全 → 高级,开启 **允许运行非应用市场扩展程序** | 180 | + 2、 设置 → 隐私和安全 → 高级,开启 **允许运行非应用市场扩展程序** |
| 178 | 181 | ||
| 179 | - 3、终端执行: zsh -c "$(curl -fsSL https://harmonybrew.atomgit.com/install.sh)" | 182 | + 3、终端执行: zsh -c "$(curl -fsSL https://harmonybrew.atomgit.com/install.sh)" |
| 180 | 183 | ||
| 181 | - 4、 执行完脚本,**会提示你复制两行环境变量到 ~/.zshrc** ,按提示执行。 | 184 | + 4、 执行完脚本,**会提示你复制两行环境变量到 ~/.zshrc** ,按提示执行。 |
| 182 | 185 | ||
| 183 | 完成后,再次执行 `brew --version`,显示版本号,则安装成功。 | 186 | 完成后,再次执行 `brew --version`,显示版本号,则安装成功。 |
| 184 | 187 | ||
| 185 | - 安装构建工具: | 188 | - 安装构建工具: |
| 186 | 189 | ||
| 187 | - ```bash | 190 | + ```bash |
| 188 | - brew install node git cmake ninja | 191 | + brew install node git cmake ninja |
| 189 | - for c in node npm npx git cmake ninja hdc ohpm hvigorw python3; do printf '%-8s: ' $c; command -v $c || echo MISSING; done | 192 | + for c in node npm npx git cmake ninja hdc ohpm hvigorw python3; do printf '%-8s: ' $c; command -v $c || echo MISSING; done |
| 190 | - ``` | 193 | + ``` |
| 191 | 194 | ||
| 192 | - 其中 `python3` 在鸿蒙 PC 上默认缺失,若构建过程提示缺少 python,可尝试通过 `brew install python` 安装。 | 195 | + 其中 `python3` 在鸿蒙 PC 上默认缺失,若构建过程提示缺少 python,可尝试通过 `brew install python` 安装。 |
| 193 | 196 | ||
| 194 | b. ohpm / hvigorw 配置。 | 197 | b. ohpm / hvigorw 配置。 |
| 195 | 198 | ||
| 196 | - 鸿蒙 PC 上的 SDK 与命令行工具(hdc、ohpm、hvigor 等)由系统 HNP 包 `hmos-clt` 提供,不在 DevEco Studio 安装目录下;`ohpm` 与 `hvigorw` 默认未加入 PATH,若需要在终端直接使用(如执行 `ohpm i @rnoh/react-native-openharmony`),将以下内容添加到 `~/.zshrc`(路径中的版本号以本机实际为准): | 199 | + 鸿蒙 PC 上的 SDK 与命令行工具(hdc、ohpm、hvigor 等)由系统 HNP 包 `hmos-clt` 提供,不在 DevEco Studio 安装目录下;`ohpm` 与 `hvigorw` 默认未加入 PATH,若需要在终端直接使用(如执行 `ohpm i @rnoh/react-native-openharmony`),将以下内容添加到 `~/.zshrc`(路径中的版本号以本机实际为准): |
| 197 | 200 | ||
| 198 | - ```bash | 201 | + ```bash |
| 199 | - export HMOS_CLT_HOME=/data/service/hnp/hmos-clt.org/hmos-clt_1.0.0 | 202 | + export HMOS_CLT_HOME=/data/service/hnp/hmos-clt.org/hmos-clt_1.0.0 |
| 200 | - export PATH="$HMOS_CLT_HOME/ohpm/bin:$HMOS_CLT_HOME/hvigor/bin:$PATH" | 203 | + export PATH="$HMOS_CLT_HOME/ohpm/bin:$HMOS_CLT_HOME/hvigor/bin:$PATH" |
| 201 | - ``` | 204 | + ``` |
| 202 | 205 | ||
| 203 | - 添加后执行 `source ~/.zshrc` 生效。使用 DevEco Studio 图形界面构建时无需本步骤,IDE 会使用内置工具链;也可以不安装 GUI 版 IDE,改用命令行工具 `devecocli`(npm 全局包 `@deveco/deveco-cli`,通过 `npm i -g @deveco/deveco-cli` 安装)完成鸿蒙工程的创建、构建、运行与签名。 | 206 | + 添加后执行 `source ~/.zshrc` 生效。使用 DevEco Studio 图形界面构建时无需本步骤,IDE 会使用内置工具链;也可以不安装 GUI 版 IDE,改用命令行工具 `devecocli`(npm 全局包 `@deveco/deveco-cli`,通过 `npm i -g @deveco/deveco-cli` 安装)完成鸿蒙工程的创建、构建、运行与签名。 |
| 204 | 207 | ||
| 205 | # 创建React Native工程 | 208 | # 创建React Native工程 |
| 206 | 209 | ||
| @@ -208,10 +211,10 @@ | |||
| 208 | 211 | ||
| 209 | ## 创建新项目 | 212 | ## 创建新项目 |
| 210 | 213 | ||
| 211 | -可选择一个目录,例如 D 盘根目录,使用 `@react-native-community/cli` 创建一个名为 “AwesomeProject” 的新项目。该工具无需全局安装,可直接通过 node 自带的 `npx` 执行。当前 React Native for OpenHarmony 基于社区 RN **0.86.3** 适配,请通过 `--version` 指定 RN 版本: | 214 | +可选择一个目录,例如 D 盘根目录,使用 `@react-native-community/cli` 创建一个名为 “AwesomeProject” 的新项目。该工具无需全局安装,可直接通过 node 自带的 `npx` 执行。当前 React Native for OpenHarmony 基于社区 RN **0.88.1** 适配,请通过 `--version` 指定 RN 版本: |
| 212 | 215 | ||
| 213 | ```bash | 216 | ```bash |
| 214 | -npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 | 217 | +npx @react-native-community/cli@latest init AwesomeProject --version 0.88.1 |
| 215 | ``` | 218 | ``` |
| 216 | 219 | ||
| 217 | > **说明**:`npx react-native init` 已废弃,请勿再使用。若出现 `NPX has cached version != current release` 警告,可忽略;该警告不影响项目创建。 | 220 | > **说明**:`npx react-native init` 已废弃,请勿再使用。若出现 `NPX has cached version != current release` 警告,可忽略;该警告不影响项目创建。 |
| @@ -221,7 +224,7 @@ npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 | |||
| 221 | 该命令在 mac 环境下初始化 React Native 项目时会下载 iOS 依赖库,耗时较长,开发者可以选择执行以下命令跳过该过程,后续根据需要自行下载,不影响鸿蒙项目开发: | 224 | 该命令在 mac 环境下初始化 React Native 项目时会下载 iOS 依赖库,耗时较长,开发者可以选择执行以下命令跳过该过程,后续根据需要自行下载,不影响鸿蒙项目开发: |
| 222 | 225 | ||
| 223 | ```bash | 226 | ```bash |
| 224 | -npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 --skip-install | 227 | +npx @react-native-community/cli@latest init AwesomeProject --version 0.88.1 --skip-install |
| 225 | ``` | 228 | ``` |
| 226 | 229 | ||
| 227 |  | 230 |  |
| @@ -250,29 +253,29 @@ npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 --sk | |||
| 250 | + "dev": "react-native bundle-harmony --dev" | 253 | + "dev": "react-native bundle-harmony --dev" |
| 251 | }, | 254 | }, |
| 252 | "dependencies": { | 255 | "dependencies": { |
| 253 | - + "@react-native-oh/react-native-harmony": "0.86.1", | 256 | + + "@react-native-oh/react-native-harmony": "0.88.1", |
| 254 | - + "@react-native-oh/react-native-harmony-cli": "0.86.1", | 257 | + "react": "19.3.0", |
| 255 | - "react": "19.2.3", | 258 | + "react-native": "0.88.1" |
| 256 | - "react-native": "0.86.3" | ||
| 257 | }, | 259 | }, |
| 258 | "devDependencies": { | 260 | "devDependencies": { |
| 259 | "@babel/core": "^7.25.2", | 261 | "@babel/core": "^7.25.2", |
| 260 | "@babel/preset-env": "^7.25.3", | 262 | "@babel/preset-env": "^7.25.3", |
| 261 | "@babel/runtime": "^7.25.0", | 263 | "@babel/runtime": "^7.25.0", |
| 262 | - "@react-native-community/cli": "20.1.0", | 264 | + "@react-native-community/cli": "20.2.0", |
| 263 | - "@react-native-community/cli-platform-android": "20.1.0", | 265 | + "@react-native-community/cli-platform-android": "20.2.0", |
| 264 | - "@react-native-community/cli-platform-ios": "20.1.0", | 266 | + "@react-native-community/cli-platform-ios": "20.2.0", |
| 265 | - "@react-native/babel-preset": "0.86.3", | 267 | + + "@react-native-oh/react-native-harmony-cli": "0.88.1", |
| 266 | - "@react-native/eslint-config": "0.86.3", | 268 | + "@react-native/babel-preset": "0.88.1", |
| 267 | - "@react-native/metro-config": "0.86.3", | 269 | + "@react-native/eslint-config": "0.88.1", |
| 268 | - "@react-native/typescript-config": "0.86.3", | 270 | + "@react-native/metro-config": "0.88.1", |
| 271 | + "@react-native/typescript-config": "0.88.1", | ||
| 269 | "@types/jest": "^29.5.13", | 272 | "@types/jest": "^29.5.13", |
| 270 | "@types/react": "^19.2.0", | 273 | "@types/react": "^19.2.0", |
| 271 | "@types/react-test-renderer": "^19.1.0", | 274 | "@types/react-test-renderer": "^19.1.0", |
| 272 | "eslint": "^8.19.0", | 275 | "eslint": "^8.19.0", |
| 273 | "jest": "^29.6.3", | 276 | "jest": "^29.6.3", |
| 274 | "prettier": "2.8.8", | 277 | "prettier": "2.8.8", |
| 275 | - "react-test-renderer": "19.2.3", | 278 | + "react-test-renderer": "19.3.0", |
| 276 | "typescript": "^5.8.3" | 279 | "typescript": "^5.8.3" |
| 277 | }, | 280 | }, |
| 278 | "engines": { | 281 | "engines": { |
| @@ -280,15 +283,15 @@ npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 --sk | |||
| 280 | } | 283 | } |
| 281 | } | 284 | } |
| 282 | ``` | 285 | ``` |
| 283 | -2. 在 `AwesomeProject` 目录下运行安装依赖包命令: | 286 | +2. 在 `AwesomeProject` 目录下运行安装依赖包命令: |
| 284 | 287 | ||
| 285 | ```bash | 288 | ```bash |
| 286 | - npm install @react-native-oh/react-native-harmony@0.86.1 @react-native-oh/react-native-harmony-cli@0.86.1 | 289 | + npm install @react-native-oh/react-native-harmony@0.88.1 @react-native-oh/react-native-harmony-cli@0.88.1 |
| 287 | ``` | 290 | ``` |
| 288 | 291 | ||
| 289 | > 注意: | 292 | > 注意: |
| 290 | > | 293 | > |
| 291 | - > 1. 建议使用对应版本线的稳定版 dist-tag(如 `0.86-stable`)获取最新稳定版:`npm install @react-native-oh/react-native-harmony@0.86-stable`;版本与安装方式详见 [RNOH 版本信息](../../05-运维/版本说明.md)。 | 294 | + > 1. 生产请使用已发布的稳定版 dist-tag(如 `0.82-stable`)。0.88 线尚未发布到 npm,请改用本地包。版本与安装方式详见 [RNOH 版本信息](../../05-运维/版本说明.md)。 |
| 292 | > 2. 本地安装鸿蒙化依赖,请参考[如何使用本地包安装鸿蒙化依赖](../../05-运维/版本升级指导.md#如何使用本地包安装鸿蒙化依赖)。 | 295 | > 2. 本地安装鸿蒙化依赖,请参考[如何使用本地包安装鸿蒙化依赖](../../05-运维/版本升级指导.md#如何使用本地包安装鸿蒙化依赖)。 |
| 293 | > 3. 如何从本地依赖切换至远程依赖,请参考[如何从本地依赖切换至远程依赖](../../05-运维/版本升级指导.md#如何从本地依赖切换至远程依赖)。 | 296 | > 3. 如何从本地依赖切换至远程依赖,请参考[如何从本地依赖切换至远程依赖](../../05-运维/版本升级指导.md#如何从本地依赖切换至远程依赖)。 |
| 294 | 297 | ||
| @@ -354,7 +357,7 @@ npx @react-native-community/cli@latest init AwesomeProject --version 0.86.3 --sk | |||
| 354 | 357 | ||
| 355 |  | 358 |  |
| 356 | 359 | ||
| 357 | -点击 `Next` 按钮,并在 `Compile SDK` 中选择 **API17**(RNOH 0.86.1 最低要求,需 DevEco Studio 6.1.0 及以上),创建一个名为 “MyApplication” 的项目。注意项目路径不要太长,如图所示: | 360 | +点击 `Next` 按钮,并在 `Compile SDK` 中选择 **API 26**(RNOH 0.88.1 基线,需 DevEco Studio 26.0.0 及以上),创建一个名为 “MyApplication” 的项目。注意项目路径不要太长,如图所示: |
| 358 | 361 | ||
| 359 |  | 362 |  |
| 360 | 363 | ||
| @@ -413,14 +416,14 @@ ohpm i @rnoh/react-native-openharmony@x.x.x | |||
| 413 | 416 | ||
| 414 | - 需要导入 `RNOH/PackageProvider`; | 417 | - 需要导入 `RNOH/PackageProvider`; |
| 415 | - 实现 `getPackages` 方法,用于创建三方库或自定义 TurboModule 或 Fabric 的 package 对象。 | 418 | - 实现 `getPackages` 方法,用于创建三方库或自定义 TurboModule 或 Fabric 的 package 对象。 |
| 416 | - | 419 | + |
| 417 | > 此处不涉及三方库与自定义 TurboModule 或组件,需要返回空数组。 | 420 | > 此处不涉及三方库与自定义 TurboModule 或组件,需要返回空数组。 |
| 418 | 421 | ||
| 419 | ```cpp | 422 | ```cpp |
| 420 | #include "RNOH/PackageProvider.h" | 423 | #include "RNOH/PackageProvider.h" |
| 421 | - | 424 | + |
| 422 | using namespace rnoh; | 425 | using namespace rnoh; |
| 423 | - | 426 | + |
| 424 | std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) { | 427 | std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) { |
| 425 | return {}; | 428 | return {}; |
| 426 | } | 429 | } |
| @@ -488,10 +491,12 @@ ohpm i @rnoh/react-native-openharmony@x.x.x | |||
| 488 | ``` | 491 | ``` |
| 489 | 492 | ||
| 490 | 2. 在 `MyApplication\entry\src\main\ets` 目录下新增 `RNPackagesFactory.ets`,该文件需要满足以下要求: | 493 | 2. 在 `MyApplication\entry\src\main\ets` 目录下新增 `RNPackagesFactory.ets`,该文件需要满足以下要求: |
| 494 | + | ||
| 491 | - 在 `@rnoh/react-native-openharmony` 导入 `RNPackageContext` 和 `RNPackage`; | 495 | - 在 `@rnoh/react-native-openharmony` 导入 `RNPackageContext` 和 `RNPackage`; |
| 492 | - 在文件中导出 `createRNPackages` 方法,用于创建三方库或自定义 TurboModule、Fabric的package 对象。 | 496 | - 在文件中导出 `createRNPackages` 方法,用于创建三方库或自定义 TurboModule、Fabric的package 对象。 |
| 493 | - | 497 | + |
| 494 | > 此处不涉及三方库与自定义TurboModule或组件,需要返回空数组。 | 498 | > 此处不涉及三方库与自定义TurboModule或组件,需要返回空数组。 |
| 499 | + | ||
| 495 | ```typescript | 500 | ```typescript |
| 496 | import { | 501 | import { |
| 497 | RNPackageContext, | 502 | RNPackageContext, |
| @@ -501,6 +506,7 @@ ohpm i @rnoh/react-native-openharmony@x.x.x | |||
| 501 | return []; | 506 | return []; |
| 502 | } | 507 | } |
| 503 | ``` | 508 | ``` |
| 509 | + | ||
| 504 | 3. 打开 `MyApplication\entry\src\main\ets\pages\Index.ets`,添加RNOH的使用代码,修改后如下: | 510 | 3. 打开 `MyApplication\entry\src\main\ets\pages\Index.ets`,添加RNOH的使用代码,修改后如下: |
| 505 | 511 | ||
| 506 | > `RNApp`的参数`appKey`需要与RN工程中`AppRegistry.registerComponent`注册的`appName`保持一致,否则会导致白屏。 | 512 | > `RNApp`的参数`appKey`需要与RN工程中`AppRegistry.registerComponent`注册的`appName`保持一致,否则会导致白屏。 |
| @@ -648,9 +654,8 @@ const styles = StyleSheet.create({ | |||
| 648 | 654 | ||
| 649 | export default App; | 655 | export default App; |
| 650 | ``` | 656 | ``` |
| 651 | -> 内容替换完成后需要重新生成bundle包。 | ||
| 652 | 657 | ||
| 653 | -> 内容替换完成后需要重新生成bundle包。 | 658 | +> 内容替换完成后执行 `npm run dev`(或 `npx react-native bundle-harmony --dev`)重新生成 `harmony/entry/src/main/resources/rawfile/bundle.harmony.js` 和 `assets` 目录,然后重新同步并构建鸿蒙工程。 |
| 654 | 659 | ||
| 655 | ## release包使用 | 660 | ## release包使用 |
| 656 | 661 | ||
| @@ -708,7 +713,8 @@ export default App; | |||
| 708 | { | 713 | { |
| 709 | "name": "default", | 714 | "name": "default", |
| 710 | "signingConfig": "default", | 715 | "signingConfig": "default", |
| 711 | - "compatibleSdkVersion": "5.0.1(13)", | 716 | + "compatibleSdkVersion": "5.0.0(12)", |
| 717 | + "targetSdkVersion": "26.0.0", | ||
| 712 | "runtimeOS": "HarmonyOS", | 718 | "runtimeOS": "HarmonyOS", |
| 713 | + "buildOption": { | 719 | + "buildOption": { |
| 714 | + "strictMode": { | 720 | + "strictMode": { |
| @@ -1,17 +1,17 @@ | |||
| 1 | # Codegen | 1 | # Codegen |
| 2 | 2 | ||
| 3 | -如[React Native新架构的Codegen文档](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/codegen.md)所介绍,在创建 ` Turbo Native Module` 和 `Fabric Native Component` 时我们通常使用 `Codegen` 来生成胶水代码。 | 3 | +如[React Native新架构的Codegen文档](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/codegen.md)所介绍,在创建 ` Turbo Native Module` 和 `Fabric Native Component` 时我们通常使用 `Codegen` 来生成胶水代码。 |
| 4 | 4 | ||
| 5 | 在**RNOH** 中我们也创建了鸿蒙化的 Codegen 工具,下面是详细的介绍。 | 5 | 在**RNOH** 中我们也创建了鸿蒙化的 Codegen 工具,下面是详细的介绍。 |
| 6 | 6 | ||
| 7 | ## 环境准备 | 7 | ## 环境准备 |
| 8 | 8 | ||
| 9 | -**RNOH** 的 `Codegen` 功能从 0.72.13 版本开始支持,当前 0.86.x 版本继续提供该能力。要使用 `Codegen`,需安装 `@react-native-oh/react-native-harmony` 及 `@react-native-oh/react-native-harmony-cli`,版本请参考 [版本说明](../../05-运维/版本说明.md)。 | 9 | +**RNOH** 的 `Codegen` 功能从 0.72.13 版本开始支持,当前 0.88.x 版本继续提供该能力。要使用 `Codegen`,需安装 `@react-native-oh/react-native-harmony` 及 `@react-native-oh/react-native-harmony-cli`,版本请参考 [版本说明](../../05-运维/版本说明.md)。 |
| 10 | 10 | ||
| 11 | `Codegen` 的使用 demo 可参考下面两个工程: | 11 | `Codegen` 的使用 demo 可参考下面两个工程: |
| 12 | 12 | ||
| 13 | -* [TurboModule的demo工程](../../../Samples/using_turboModule/README_zh.md) | 13 | +- [TurboModule的demo工程](../../../Samples/using_turboModule/README_zh.md) |
| 14 | -* [自定义Fabric组件](../../../Samples/FabricComponentSample/README_zh.md) | 14 | +- [自定义Fabric组件](../../../Samples/FabricComponentSample/README_zh.md) |
| 15 | 15 | ||
| 16 | ## 使用说明 | 16 | ## 使用说明 |
| 17 | 17 | ||
| @@ -30,9 +30,9 @@ | |||
| 30 | 30 | ||
| 31 | 详细的流程可参考下面几篇文档的介绍: | 31 | 详细的流程可参考下面几篇文档的介绍: |
| 32 | 32 | ||
| 33 | -* [自定义TurboModule的实现](./TurboModule.md) | 33 | +- [自定义TurboModule的实现](./TurboModule.md) |
| 34 | -* [自定义组件开发指导](./自定义组件.md) | 34 | +- [自定义组件开发指导](./自定义组件.md) |
| 35 | -* [C-API组件混合方案的使用](./C-API组件混合方案的使用.md) | 35 | +- [C-API组件混合方案的使用](./C-API组件混合方案的使用.md) |
| 36 | 36 | ||
| 37 | ### 配置 Codegen | 37 | ### 配置 Codegen |
| 38 | 38 | ||
| @@ -41,7 +41,7 @@ | |||
| 41 | #### 1. codegenConfig | 41 | #### 1. codegenConfig |
| 42 | 42 | ||
| 43 | 同 Android 和 IOS,Codegen 是基于三方库或者前端工程的 package.json 中的 codegenConfig 配置来生成代码的,不过需要注意的是,在 **RNOH** 中,`codegenConfig` 字段需要嵌套在 `harmony` 中,如: | 43 | 同 Android 和 IOS,Codegen 是基于三方库或者前端工程的 package.json 中的 codegenConfig 配置来生成代码的,不过需要注意的是,在 **RNOH** 中,`codegenConfig` 字段需要嵌套在 `harmony` 中,如: |
| 44 | -指导文档:https://reactnative.dev/docs/0.86/the-new-architecture/using-codegen | 44 | +指导文档:https://reactnative.dev/docs/0.88/the-new-architecture/using-codegen |
| 45 | 45 | ||
| 46 | ```json | 46 | ```json |
| 47 | ... | 47 | ... |
| @@ -71,8 +71,8 @@ | |||
| 71 | 71 | ||
| 72 | 其中: | 72 | 其中: |
| 73 | 73 | ||
| 74 | -- **version**:表示版本,需要强调一下,这里的版本并没有新旧之说,它们只是使用场景不同而已。 | 74 | +- **version**:表示版本,需要强调一下,这里的版本并没有新旧之说,它们只是使用场景不同而已。 |
| 75 | - `"version": 1` 适用于创建 TurboModule 或者是 ArkTS 组件的场景; | 75 | + `"version": 1` 适用于创建 TurboModule 或者是 ArkTS 组件的场景; |
| 76 | `"version": 2` 则适用于创建 **CAPI** 组件的场景。 | 76 | `"version": 2` 则适用于创建 **CAPI** 组件的场景。 |
| 77 | 77 | ||
| 78 | - **specPaths**:表示声明文件的路径 | 78 | - **specPaths**:表示声明文件的路径 |
| @@ -100,7 +100,6 @@ | |||
| 100 | 100 | ||
| 101 | - **--no-safety-check \[boolean\]**:默认情况下 Codegen 无法在工作目录以外进行文件操作,通过配置 `--no-safety-check` 可跳过该检查,如鸿蒙工程不在前端工程目录下时需要传入该参数。 | 101 | - **--no-safety-check \[boolean\]**:默认情况下 Codegen 无法在工作目录以外进行文件操作,通过配置 `--no-safety-check` 可跳过该检查,如鸿蒙工程不在前端工程目录下时需要传入该参数。 |
| 102 | 102 | ||
| 103 | - | ||
| 104 | ## codegen生成及结构 | 103 | ## codegen生成及结构 |
| 105 | 104 | ||
| 106 | 执行 Codegen 命令后,Codegen 生成的文件结构如下: | 105 | 执行 Codegen 命令后,Codegen 生成的文件结构如下: |
| @@ -155,7 +154,7 @@ | |||
| 155 | 154 | ||
| 156 | ## Codegen-lib-harmony | 155 | ## Codegen-lib-harmony |
| 157 | 156 | ||
| 158 | -`codegen-harmony` 会遍历 `node_module` 目录下所有三方库的 Codegen 配置,然后生成所有的胶水代码。但有的开发者由于各种原因(比如不同三方库胶水代码存放不同位置等),希望能只为某个三方件胶水代码,此时可以使用 `codegen-lib-harmony` 命令。`codegen-lib-harmony` 是 `react-native-harmony-cli@0.0.27` 提供的新能力,使用之前先检查一下依赖。 | 157 | +`codegen-harmony` 会遍历 `node_module` 目录下所有三方库的 Codegen 配置,然后生成所有的胶水代码。但有的开发者由于各种原因(比如不同三方库胶水代码存放不同位置等),希望能只为某个三方件胶水代码,此时可以使用 `codegen-lib-harmony` 命令。`codegen-lib-harmony` 是 `react-native-harmony-cli@0.0.27` 提供的新能力,使用之前先检查一下依赖。 |
| 159 | 158 | ||
| 160 | 跟 `codegen-harmony` 类似,`codegen-lib-harmony` 的使用也是大致分为以下步骤: | 159 | 跟 `codegen-harmony` 类似,`codegen-lib-harmony` 的使用也是大致分为以下步骤: |
| 161 | 160 | ||
| @@ -165,7 +164,7 @@ | |||
| 165 | 4. 执行 Codegen; | 164 | 4. 执行 Codegen; |
| 166 | 5. 编写原生代码以实现 TurboModule 或 Fabric 组件的功能; | 165 | 5. 编写原生代码以实现 TurboModule 或 Fabric 组件的功能; |
| 167 | 6. 在 JavaScript 侧调用 | 166 | 6. 在 JavaScript 侧调用 |
| 168 | - | 167 | + |
| 169 | ### 配置 Codegen | 168 | ### 配置 Codegen |
| 170 | 169 | ||
| 171 | 这一步是在三方库中操作,与 `codegen-harmony` 不同,这里不需要在三方库 package.json 中配置 codegenConfig 字段,或者 `harmony::codegenConfig::specPaths` 中不应包含需要单独生成胶水代码的 JavaScript 声明文件。 | 170 | 这一步是在三方库中操作,与 `codegen-harmony` 不同,这里不需要在三方库 package.json 中配置 codegenConfig 字段,或者 `harmony::codegenConfig::specPaths` 中不应包含需要单独生成胶水代码的 JavaScript 声明文件。 |
| @@ -1,4 +1,4 @@ | |||
| 1 | -This documentation is based on React Native documentation licensed under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license at https://reactnative.cn/docs/0.86/turbo-native-modules-introduction. © Meta Platforms Inc. Changed to How to create a TurboModule on OpenHarmony. | 1 | +This documentation is based on React Native documentation licensed under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license at https://reactnative.cn/docs/0.88/turbo-native-modules-introduction. © Meta Platforms Inc. Changed to How to create a TurboModule on OpenHarmony. |
| 2 | 2 | ||
| 3 | # 自定义TurboModule的实现 | 3 | # 自定义TurboModule的实现 |
| 4 | 4 | ||
| @@ -84,8 +84,8 @@ export default TurboModuleRegistry.get<Spec>( | |||
| 84 | }, | 84 | }, |
| 85 | "devDependencies": { | 85 | "devDependencies": { |
| 86 | "@types/react": "^19.2.0", | 86 | "@types/react": "^19.2.0", |
| 87 | - "react": "19.2.3", | 87 | + "react": "19.3.0", |
| 88 | - "react-native": "0.86.3" | 88 | + "react-native": "0.88.1" |
| 89 | }, | 89 | }, |
| 90 | "dependencies": {} | 90 | "dependencies": {} |
| 91 | } | 91 | } |
| @@ -241,7 +241,7 @@ Codegen 的详细使用方法,可以参考[Codegen](Codegen.md)文档。 | |||
| 241 | 241 | ||
| 242 | 3. 如果是 CxxTurboModule,需要一些额外步骤: | 242 | 3. 如果是 CxxTurboModule,需要一些额外步骤: |
| 243 | 243 | ||
| 244 | - 什么是:CxxTurboModule,请参考[React Native 中文网](https://reactnative.cn/docs/0.86/the-new-architecture/pure-cxx-modules)。 | 244 | + 什么是:CxxTurboModule,请参考[React Native 中文网](https://reactnative.cn/docs/0.88/the-new-architecture/pure-cxx-modules)。 |
| 245 | 245 | ||
| 246 | 以 CalculatorModule 为例,展开胶水代码文件 `RTNCalculator.cpp` 中的宏 ARK_ASYNC_METHOD_METADATA: | 246 | 以 CalculatorModule 为例,展开胶水代码文件 `RTNCalculator.cpp` 中的宏 ARK_ASYNC_METHOD_METADATA: |
| 247 | 247 | ||
| @@ -385,7 +385,7 @@ function copySymFiles(symDirPath, outputDir) { | |||
| 385 | ### 9.2 生产环境调试 | 385 | ### 9.2 生产环境调试 |
| 386 | 386 | ||
| 387 | 1. 使用 Release 版本的 har 包 | 387 | 1. 使用 Release 版本的 har 包 |
| 388 | -2. 获取对应的 .sym 文件:从 RNOH Release 页面下载符号归档物 `rnoh-symbols-<版本>-release.tar.gz`(如 `rnoh-symbols-0.86.1-release.tar.gz`)并解压;.sym 文件不随 npm 包分发,npm 包内不包含 `symbols/` 目录 | 388 | +2. 获取对应的 .sym 文件:从 RNOH Release 页面下载符号归档物 `rnoh-symbols-<版本>-release.tar.gz`(如 `rnoh-symbols-0.88.1-release.tar.gz`)并解压;.sym 文件不随 npm 包分发,npm 包内不包含 `symbols/` 目录 |
| 389 | 3. 在崩溃分析平台(如 Bugly、Sentry 等)上传 .sym 文件 | 389 | 3. 在崩溃分析平台(如 Bugly、Sentry 等)上传 .sym 文件 |
| 390 | 4. 使用 .sym 文件解析崩溃堆栈 | 390 | 4. 使用 .sym 文件解析崩溃堆栈 |
| 391 | 391 | ||
| @@ -32,7 +32,7 @@ Debug 包通常通过以下方式获取: | |||
| 32 | ```json5 | 32 | ```json5 |
| 33 | { | 33 | { |
| 34 | dependencies: { | 34 | dependencies: { |
| 35 | - "@rnoh/react-native-openharmony": "0.86.1", // 使用 Debug 版本 | 35 | + "@rnoh/react-native-openharmony": "0.88.1", // 使用 Debug 版本 |
| 36 | }, | 36 | }, |
| 37 | } | 37 | } |
| 38 | ``` | 38 | ``` |
| @@ -137,7 +137,7 @@ Release 包通过以下方式获取: | |||
| 137 | ```json5 | 137 | ```json5 |
| 138 | { | 138 | { |
| 139 | dependencies: { | 139 | dependencies: { |
| 140 | - "@rnoh/react-native-openharmony": "0.86.1", // 指定版本 | 140 | + "@rnoh/react-native-openharmony": "0.88.1", // 指定版本 |
| 141 | }, | 141 | }, |
| 142 | } | 142 | } |
| 143 | ``` | 143 | ``` |
| @@ -333,7 +333,7 @@ add_compile_definitions( | |||
| 333 | 1. 打开 DevEco Studio | 333 | 1. 打开 DevEco Studio |
| 334 | 2. **File > Settings > HarmonyOS SDK** | 334 | 2. **File > Settings > HarmonyOS SDK** |
| 335 | 3. 配置 SDK 路径和版本: | 335 | 3. 配置 SDK 路径和版本: |
| 336 | - - HarmonyOS SDK:建议使用 API 10 或以上 | 336 | + - HarmonyOS SDK:目标 SDK 使用 API 26,与仓库模板的 `compatibleSdkVersion` 5.0.0(12)、`targetSdkVersion` 26.0.0 保持一致。编译 SDK 选择目标 DevEco 安装的版本,并对最终设备 ROM 进行验证 |
| 337 | - Native SDK:包含 NDK 工具链 | 337 | - Native SDK:包含 NDK 工具链 |
| 338 | 338 | ||
| 339 | #### NDK 配置 | 339 | #### NDK 配置 |
| @@ -10,7 +10,7 @@ RN原始社区信息:[https://reactnative.dev](https://reactnative.dev) | |||
| 10 | 10 | ||
| 11 | RN三方库鸿蒙化信息:[https://gitcode.com/CPF-RN/usage-docs](https://gitcode.com/CPF-RN/usage-docs) | 11 | RN三方库鸿蒙化信息:[https://gitcode.com/CPF-RN/usage-docs](https://gitcode.com/CPF-RN/usage-docs) |
| 12 | 12 | ||
| 13 | -业界根据bundle的集成模式将开发RN App主要分为集成模式和分离模式,可参考:[React Native ](https://docs.taro.zone/docs/react-native/)[端开发流程 ](https://docs.taro.zone/docs/react-native/)[| Taro ](https://docs.taro.zone/docs/react-native/)[文档](https://docs.taro.zone/docs/react-native/)。 | 13 | +业界根据 bundle 的集成模式将开发 RN App 主要分为集成模式和分离模式,可参考 [Taro React Native 端开发流程文档](https://docs.taro.zone/docs/react-native/)。 |
| 14 | 14 | ||
| 15 | 集成模式:JS工程与壳工程在一个工程中,编译打包时候一起编译打包出一个应用包 | 15 | 集成模式:JS工程与壳工程在一个工程中,编译打包时候一起编译打包出一个应用包 |
| 16 | 16 | ||
| @@ -36,10 +36,10 @@ RN项目的开发主要分为原生端工程开发和JS侧工程开发。原生 | |||
| 36 | 36 | ||
| 37 | ### 创建RNJS新项目 | 37 | ### 创建RNJS新项目 |
| 38 | 38 | ||
| 39 | -可选择一个目录,使用 `@react-native-community/cli` 创建一个名为 GuideJS 的新项目。该工具无需全局安装,可直接通过 node 自带的 `npx` 执行。当前 React Native for OpenHarmony 基于社区 RN **0.86.3** 适配,请通过 `--version` 指定 RN 版本: | 39 | +可选择一个目录,使用 `@react-native-community/cli` 创建一个名为 GuideJS 的新项目。该工具无需全局安装,可直接通过 node 自带的 `npx` 执行。当前 React Native for OpenHarmony 基于社区 RN **0.88.1** 适配,请通过 `--version` 指定 RN 版本: |
| 40 | 40 | ||
| 41 | ```bash | 41 | ```bash |
| 42 | -npx @react-native-community/cli@latest init GuideJS --version 0.86.3 | 42 | +npx @react-native-community/cli@latest init GuideJS --version 0.88.1 |
| 43 | ``` | 43 | ``` |
| 44 | 44 | ||
| 45 |  | 45 |  |
| @@ -49,7 +49,7 @@ npx @react-native-community/cli@latest init GuideJS --version 0.86.3 | |||
| 49 | 该命令在 mac 环境下初始化 React Native 项目时会下载 iOS 依赖库,耗时较长,开发者可以选择执行以下命令跳过该过程,后续根据需要自行下载,不影响鸿蒙项目开发: | 49 | 该命令在 mac 环境下初始化 React Native 项目时会下载 iOS 依赖库,耗时较长,开发者可以选择执行以下命令跳过该过程,后续根据需要自行下载,不影响鸿蒙项目开发: |
| 50 | 50 | ||
| 51 | ```bash | 51 | ```bash |
| 52 | -npx @react-native-community/cli@latest init GuideJS --version 0.86.3 --skip-install | 52 | +npx @react-native-community/cli@latest init GuideJS --version 0.88.1 --skip-install |
| 53 | ``` | 53 | ``` |
| 54 | 54 | ||
| 55 | 上面的操作将得到一个基本的RNJS工程,这就是一个传统的android和ios对应的RN工程,在android和ios目录中存放了其对应native工程,为了扩展使其支持鸿蒙工程,在根目录下新建一个harmony目录用于存放鸿蒙native工程,然后可以得到如下文件: | 55 | 上面的操作将得到一个基本的RNJS工程,这就是一个传统的android和ios对应的RN工程,在android和ios目录中存放了其对应native工程,为了扩展使其支持鸿蒙工程,在根目录下新建一个harmony目录用于存放鸿蒙native工程,然后可以得到如下文件: |
| @@ -70,27 +70,27 @@ npx @react-native-community/cli@latest init GuideJS --version 0.86.3 --skip-inst | |||
| 70 | + "dev": "react-native bundle-harmony --dev" | 70 | + "dev": "react-native bundle-harmony --dev" |
| 71 | }, | 71 | }, |
| 72 | "dependencies": { | 72 | "dependencies": { |
| 73 | - "react": "19.2.3", | 73 | + "react": "19.3.0", |
| 74 | - "react-native": "0.86.3" | 74 | + "react-native": "0.88.1" |
| 75 | }, | 75 | }, |
| 76 | "devDependencies": { | 76 | "devDependencies": { |
| 77 | "@babel/core": "^7.25.2", | 77 | "@babel/core": "^7.25.2", |
| 78 | "@babel/preset-env": "^7.25.3", | 78 | "@babel/preset-env": "^7.25.3", |
| 79 | "@babel/runtime": "^7.25.0", | 79 | "@babel/runtime": "^7.25.0", |
| 80 | - "@react-native-community/cli": "20.1.0", | 80 | + "@react-native-community/cli": "20.2.0", |
| 81 | - "@react-native-community/cli-platform-android": "20.1.0", | 81 | + "@react-native-community/cli-platform-android": "20.2.0", |
| 82 | - "@react-native-community/cli-platform-ios": "20.1.0", | 82 | + "@react-native-community/cli-platform-ios": "20.2.0", |
| 83 | - "@react-native/babel-preset": "0.86.3", | 83 | + "@react-native/babel-preset": "0.88.1", |
| 84 | - "@react-native/eslint-config": "0.86.3", | 84 | + "@react-native/eslint-config": "0.88.1", |
| 85 | - "@react-native/metro-config": "0.86.3", | 85 | + "@react-native/metro-config": "0.88.1", |
| 86 | - "@react-native/typescript-config": "0.86.3", | 86 | + "@react-native/typescript-config": "0.88.1", |
| 87 | "@types/jest": "^29.5.13", | 87 | "@types/jest": "^29.5.13", |
| 88 | "@types/react": "^19.2.0", | 88 | "@types/react": "^19.2.0", |
| 89 | - "@types/react-test-renderer": "^19.2.0", | 89 | + "@types/react-test-renderer": "^19.1.0", |
| 90 | "eslint": "^8.19.0", | 90 | "eslint": "^8.19.0", |
| 91 | "jest": "^29.6.3", | 91 | "jest": "^29.6.3", |
| 92 | "prettier": "2.8.8", | 92 | "prettier": "2.8.8", |
| 93 | - "react-test-renderer": "19.2.3", | 93 | + "react-test-renderer": "19.3.0", |
| 94 | "typescript": "^5.8.3" | 94 | "typescript": "^5.8.3" |
| 95 | }, | 95 | }, |
| 96 | "engines": { | 96 | "engines": { |
| @@ -117,7 +117,7 @@ npm i @react-native-oh/react-native-harmony-cli@x.x.x | |||
| 117 | 117 | ||
| 118 | ### RNJS工程生成bundle | 118 | ### RNJS工程生成bundle |
| 119 | 119 | ||
| 120 | -1. 打开 `GuideJS/metro.config.js`,并添加 OpenHarmony 的适配代码。配置文件的详细介绍,可以参考 [React Native Metro 文档](https://reactnative.dev/docs/0.86/metro)。修改完成后的文件内容如下: | 120 | +1. 打开 `GuideJS/metro.config.js`,并添加 OpenHarmony 的适配代码。配置文件的详细介绍,可以参考 [React Native Metro 文档](https://reactnative.dev/docs/0.88/metro)。修改完成后的文件内容如下: |
| 121 | 121 | ||
| 122 | ```javascript | 122 | ```javascript |
| 123 | const { mergeConfig, getDefaultConfig } = require("@react-native/metro-config"); | 123 | const { mergeConfig, getDefaultConfig } = require("@react-native/metro-config"); |
| @@ -177,6 +177,7 @@ npm run dev | |||
| 177 | ``` | 177 | ``` |
| 178 | 178 | ||
| 179 | 在 `GuideJS` 根目录执行 `npm run dev`,产物生成到 `GuidePro/harmony/entry/src/main/resources/rawfile`。 | 179 | 在 `GuideJS` 根目录执行 `npm run dev`,产物生成到 `GuidePro/harmony/entry/src/main/resources/rawfile`。 |
| 180 | + | ||
| 180 | >  **注意:**下文的 `../GuidePro`、`../../../GuideJS` 都按两个工程同级来写,分离模式下需根据实际目录结构调整相对路径。 | 181 | >  **注意:**下文的 `../GuidePro`、`../../../GuideJS` 都按两个工程同级来写,分离模式下需根据实际目录结构调整相对路径。 |
| 181 | 182 | ||
| 182 | 由于Demo工程的JS文件比较少,实际开发过程中的JS工程会承载非常多业务,推荐按照下述结构组织JS工程结构: | 183 | 由于Demo工程的JS文件比较少,实际开发过程中的JS工程会承载非常多业务,推荐按照下述结构组织JS工程结构: |
| @@ -281,10 +282,10 @@ npm run dev | |||
| 281 | "version": "1.0.0", | 282 | "version": "1.0.0", |
| 282 | "private": true, | 283 | "private": true, |
| 283 | "dependencies": { | 284 | "dependencies": { |
| 284 | - "@react-native-oh/react-native-harmony": "0.86.1" | 285 | + "@react-native-oh/react-native-harmony": "0.88.1" |
| 285 | }, | 286 | }, |
| 286 | "devDependencies": { | 287 | "devDependencies": { |
| 287 | - "react-native": "0.86.3" | 288 | + "react-native": "0.88.1" |
| 288 | } | 289 | } |
| 289 | } | 290 | } |
| 290 | ``` | 291 | ``` |
| @@ -643,7 +644,7 @@ export default App; | |||
| 643 | "license": "", | 644 | "license": "", |
| 644 | "dependencies": { | 645 | "dependencies": { |
| 645 | - "@rnoh/react-native-openharmony": "file:./node_modules/@react-native-oh/react-native-harmony/react_native_openharmony.har", | 646 | - "@rnoh/react-native-openharmony": "file:./node_modules/@react-native-oh/react-native-harmony/react_native_openharmony.har", |
| 646 | - + "@rnoh/react-native-openharmony": "file:./node_modules/@react-native-oh/react-native-harmony/react_native_openharmony_release.har" | 647 | + + "@rnoh/react-native-openharmony": "file:./node_modules/@react-native-oh/react-native-harmony/react_native_openharmony_release.har" |
| 647 | } | 648 | } |
| 648 | } | 649 | } |
| 649 | ``` | 650 | ``` |
| @@ -678,19 +679,19 @@ export default App; | |||
| 678 | 679 | ||
| 679 | **三层防护体系概览:** | 680 | **三层防护体系概览:** |
| 680 | 681 | ||
| 681 | -| 层级 | 机制 | 作用 | 局限 | | 682 | +| 层级 | 机制 | 作用 | 局限 | |
| 682 | -|------|------|------|------| | 683 | +| ------- | ---------------------- | ----------------------------------------------------- | -------------------------------------- | |
| 683 | -| 第 1 层 | ErrorBoundary 错误边界 | 捕获子组件渲染阶段的JS错误,展示降级UI | 无法捕获事件处理函数、异步代码中的错误 | | 684 | +| 第 1 层 | ErrorBoundary 错误边界 | 捕获子组件渲染阶段的JS错误,展示降级UI | 无法捕获事件处理函数、异步代码中的错误 | |
| 684 | -| 第 2 层 | ErrorUtils 全局捕获 | 捕获所有未处理的JS异常,包括第1层无法捕获的错误 | 在release包中只能获取到混淆后的堆栈 | | 685 | +| 第 2 层 | ErrorUtils 全局捕获 | 捕获所有未处理的JS异常,包括第1层无法捕获的错误 | 在release包中只能获取到混淆后的堆栈 | |
| 685 | -| 第 3 层 | SourceMap 定位 | 将release包中混淆后的行列号反查回源码的具体文件和行号 | 需要.map文件,属于事后分析工具 | | 686 | +| 第 3 层 | SourceMap 定位 | 将release包中混淆后的行列号反查回源码的具体文件和行号 | 需要.map文件,属于事后分析工具 | |
| 686 | 687 | ||
| 687 | -- **[第1层:ErrorBoundary错误边界](#第1层errorboundary错误边界)** | 688 | +- **[第1层:ErrorBoundary错误边界](#第1层errorboundary错误边界)** |
| 688 | 689 | ||
| 689 | -- **[第2层:全局异常捕获](#第2层全局异常捕获)** | 690 | +- **[第2层:全局异常捕获](#第2层全局异常捕获)** |
| 690 | 691 | ||
| 691 | -- **[第3层:SourceMap定位](#第3层sourcemap定位)** | 692 | +- **[第3层:SourceMap定位](#第3层sourcemap定位)** |
| 692 | 693 | ||
| 693 | -- **[完整Demo代码](#完整demo代码)** | 694 | +- **[完整Demo代码](#完整demo代码)** |
| 694 | 695 | ||
| 695 | ### 第1层:ErrorBoundary错误边界 | 696 | ### 第1层:ErrorBoundary错误边界 |
| 696 | 697 | ||
| @@ -701,7 +702,7 @@ export default App; | |||
| 701 | 创建 `GuideJS/ErrorBoundary.tsx`。在class组件中定义 `getDerivedStateFromError` 或 `componentDidCatch` 这两个生命周期方法中的任意一个,那么它就变成一个错误边界。ErrorBoundary既可以包裹hook组件,也可以包裹class组件: | 702 | 创建 `GuideJS/ErrorBoundary.tsx`。在class组件中定义 `getDerivedStateFromError` 或 `componentDidCatch` 这两个生命周期方法中的任意一个,那么它就变成一个错误边界。ErrorBoundary既可以包裹hook组件,也可以包裹class组件: |
| 702 | 703 | ||
| 703 | ``` | 704 | ``` |
| 704 | -import React, {ErrorInfo} from 'react'; | 705 | +import React, {ErrorInfo} from 'react'; |
| 705 | import {Text, View} from 'react-native'; | 706 | import {Text, View} from 'react-native'; |
| 706 | 707 | ||
| 707 | interface IState { | 708 | interface IState { |
| @@ -785,12 +786,12 @@ export default function App() { | |||
| 785 | 786 | ||
| 786 |  | 787 |  |
| 787 | 788 | ||
| 788 | -> **注意:** | 789 | +>  **注意:** |
| 789 | ->ErrorBoundary的捕获范围有限: | 790 | +> ErrorBoundary的捕获范围有限: |
| 790 | ->(1)仅可以捕获其子组件的错误 | 791 | +> (1)仅可以捕获其子组件的错误 |
| 791 | ->(2)无法捕获的错误包括:事件处理函数、异步代码(setTimeout/Promise)等 | 792 | +> (2)无法捕获的错误包括:事件处理函数、异步代码(setTimeout/Promise)等 |
| 792 | > | 793 | > |
| 793 | ->对于ErrorBoundary无法捕获的错误,需要使用第2层全局异常捕获来兜底。 | 794 | +> 对于ErrorBoundary无法捕获的错误,需要使用第2层全局异常捕获来兜底。 |
| 794 | 795 | ||
| 795 | ### 第2层:全局异常捕获 | 796 | ### 第2层:全局异常捕获 |
| 796 | 797 | ||
| @@ -896,14 +897,13 @@ export default function App() { | |||
| 896 | 897 | ||
| 897 | 打bundle安装到设备后,点击"触发异步异常"按钮,查看日志打印: | 898 | 打bundle安装到设备后,点击"触发异步异常"按钮,查看日志打印: |
| 898 | 899 | ||
| 899 | - | ||
| 900 | 可以看到全局捕获打印了异常信息和错误堆栈: | 900 | 可以看到全局捕获打印了异常信息和错误堆栈: |
| 901 | 901 | ||
| 902 |  | 902 |  |
| 903 | 903 | ||
| 904 | -> **注意:** | 904 | +>  **注意:** |
| 905 | ->(1)可以使用 `__DEV__` 来区分debug和release包,只在release包中上报错误到服务器 | 905 | +> (1)可以使用 `__DEV__` 来区分debug和release包,只在release包中上报错误到服务器 |
| 906 | ->(2)可能有重复的错误信息,通过errorMap去重后只上报一个即可 | 906 | +> (2)可能有重复的错误信息,通过errorMap去重后只上报一个即可 |
| 907 | 907 | ||
| 908 | ### 第3层:SourceMap定位 | 908 | ### 第3层:SourceMap定位 |
| 909 | 909 | ||
| @@ -1097,9 +1097,9 @@ node .\script\findError.js 575 1000 | |||
| 1097 | 1097 | ||
| 1098 |  | 1098 |  |
| 1099 | 1099 | ||
| 1100 | -> **注意:** | 1100 | +>  **注意:** |
| 1101 | ->(1)必须使用同一次打包产出的bundle和.map文件。如果设备上运行的是release包(`--dev false`),就必须用release包的.map文件来反查;dev包和release包的行列号完全不同,混用会导致查询结果为null | 1101 | +> (1)必须使用同一次打包产出的bundle和.map文件。如果设备上运行的是release包(`--dev false`),就必须用release包的.map文件来反查;dev包和release包的行列号完全不同,混用会导致查询结果为null |
| 1102 | ->(2)dev包中函数名保留原名(如 `ErrorScreen`),不需要SourceMap即可定位;SourceMap主要用于release包中函数名被压缩(如 `u`、`r`)无法直接定位的场景 | 1102 | +> (2)dev包中函数名保留原名(如 `ErrorScreen`),不需要SourceMap即可定位;SourceMap主要用于release包中函数名被压缩(如 `u`、`r`)无法直接定位的场景 |
| 1103 | 1103 | ||
| 1104 | ### 完整Demo代码 | 1104 | ### 完整Demo代码 |
| 1105 | 1105 | ||
| @@ -1624,19 +1624,17 @@ export default App; | |||
| 1624 | 1624 | ||
| 1625 | ```json5 | 1625 | ```json5 |
| 1626 | { | 1626 | { |
| 1627 | - "modelVersion": "26.0.0", | 1627 | + modelVersion: "26.0.0", |
| 1628 | - "description": "Please describe the basic information.", | 1628 | + description: "Please describe the basic information.", |
| 1629 | - "dependencies": { | 1629 | + dependencies: {}, |
| 1630 | - }, | ||
| 1631 | overrides: { | 1630 | overrides: { |
| 1632 | "@rnoh/react-native-openharmony": "file:./entry/node_modules/@react-native-oh/react-native-harmony/react_native_openharmony.har", | 1631 | "@rnoh/react-native-openharmony": "file:./entry/node_modules/@react-native-oh/react-native-harmony/react_native_openharmony.har", |
| 1633 | }, | 1632 | }, |
| 1634 | - "devDependencies": { | 1633 | + devDependencies: { |
| 1635 | "@ohos/hypium": "1.0.25", | 1634 | "@ohos/hypium": "1.0.25", |
| 1636 | - "@ohos/hamock": "1.0.0" | 1635 | + "@ohos/hamock": "1.0.0", |
| 1637 | - } | 1636 | + }, |
| 1638 | } | 1637 | } |
| 1639 | - | ||
| 1640 | ``` | 1638 | ``` |
| 1641 | 1639 | ||
| 1642 |  | 1640 |  |
| @@ -2357,6 +2355,7 @@ codegen 依赖 react-native。脚本写在 `GuideJS/package.json`,生成代码 | |||
| 2357 | ```json | 2355 | ```json |
| 2358 | "codegen": "react-native codegen-harmony --cpp-output-path ../GuidePro/harmony/entry/src/main/cpp/generated --ets-output-path ../GuidePro/harmony/entry/src/main/ets/generated --no-safety-check" | 2356 | "codegen": "react-native codegen-harmony --cpp-output-path ../GuidePro/harmony/entry/src/main/cpp/generated --ets-output-path ../GuidePro/harmony/entry/src/main/ets/generated --no-safety-check" |
| 2359 | ``` | 2357 | ``` |
| 2358 | + | ||
| 2360 |  | 2359 |  |
| 2361 | 2360 | ||
| 2362 | 在 `GuideJS` 根目录执行: | 2361 | 在 `GuideJS` 根目录执行: |
| @@ -2370,19 +2369,25 @@ npm run codegen | |||
| 2370 | 在`GuideJS/App.tsx`文件中构建如下页面,编译成Hap后,在自由多窗下测试,随着窗口大小的变化,红色组件宽高也会随之变化: | 2369 | 在`GuideJS/App.tsx`文件中构建如下页面,编译成Hap后,在自由多窗下测试,随着窗口大小的变化,红色组件宽高也会随之变化: |
| 2371 | 2370 | ||
| 2372 | ```javascript | 2371 | ```javascript |
| 2373 | -import React from 'react'; | 2372 | +import React from "react"; |
| 2374 | -import {Text, View, StyleSheet, ScrollView} from 'react-native'; | 2373 | +import { Text, View, StyleSheet, ScrollView } from "react-native"; |
| 2375 | import { | 2374 | import { |
| 2376 | useBreakpointValue, | 2375 | useBreakpointValue, |
| 2377 | useHeightBreakpointValue, | 2376 | useHeightBreakpointValue, |
| 2378 | -} from '@hadss/react_native_breakpoints'; | 2377 | +} from "@hadss/react_native_breakpoints"; |
| 2379 | 2378 | ||
| 2380 | export default function App() { | 2379 | export default function App() { |
| 2381 | // 横向断点测试,useBreakpointValue是指在宽度变为 xs、sm、md、lg、xl时,对应输出值为320、720、1000、1440、1920,这里的数值可以自定义 | 2380 | // 横向断点测试,useBreakpointValue是指在宽度变为 xs、sm、md、lg、xl时,对应输出值为320、720、1000、1440、1920,这里的数值可以自定义 |
| 2382 | - const w = useBreakpointValue({xs: 320, sm: 720, md: 1000, lg: 1440, xl: 1920}); | 2381 | + const w = useBreakpointValue({ |
| 2382 | + xs: 320, | ||
| 2383 | + sm: 720, | ||
| 2384 | + md: 1000, | ||
| 2385 | + lg: 1440, | ||
| 2386 | + xl: 1920, | ||
| 2387 | + }); | ||
| 2383 | 2388 | ||
| 2384 | // 纵向断点测试,同理useHeightBreakpointValue是指高度变为sm、md、lg时对应输出值为280、500、720,这里的数值可以自定义 | 2389 | // 纵向断点测试,同理useHeightBreakpointValue是指高度变为sm、md、lg时对应输出值为280、500、720,这里的数值可以自定义 |
| 2385 | - const h = useHeightBreakpointValue({sm: 280, md: 500, lg: 720}); | 2390 | + const h = useHeightBreakpointValue({ sm: 280, md: 500, lg: 720 }); |
| 2386 | 2391 | ||
| 2387 | return ( | 2392 | return ( |
| 2388 | <ScrollView style={styles.container}> | 2393 | <ScrollView style={styles.container}> |
| @@ -2391,7 +2396,7 @@ export default function App() { | |||
| 2391 | w: {String(w)} ({typeof w}) | 2396 | w: {String(w)} ({typeof w}) |
| 2392 | </Text> | 2397 | </Text> |
| 2393 | 2398 | ||
| 2394 | - <Text style={[styles.header, {marginTop: 24}]}> | 2399 | + <Text style={[styles.header, { marginTop: 24 }]}> |
| 2395 | useHeightBreakpointValue(纵向)测试 | 2400 | useHeightBreakpointValue(纵向)测试 |
| 2396 | </Text> | 2401 | </Text> |
| 2397 | <Text style={styles.item}> | 2402 | <Text style={styles.item}> |
| @@ -2399,7 +2404,12 @@ export default function App() { | |||
| 2399 | </Text> | 2404 | </Text> |
| 2400 | {/* 这里使用断点值设置宽高,则当窗口大小变化时,View的大小也随之变化。 */} | 2405 | {/* 这里使用断点值设置宽高,则当窗口大小变化时,View的大小也随之变化。 */} |
| 2401 | <View | 2406 | <View |
| 2402 | - style={{width: w, maxWidth: '100%', height: h, backgroundColor: 'red'}} | 2407 | + style={{ |
| 2408 | + width: w, | ||
| 2409 | + maxWidth: "100%", | ||
| 2410 | + height: h, | ||
| 2411 | + backgroundColor: "red", | ||
| 2412 | + }} | ||
| 2403 | /> | 2413 | /> |
| 2404 | </ScrollView> | 2414 | </ScrollView> |
| 2405 | ); | 2415 | ); |
| @@ -2408,12 +2418,12 @@ export default function App() { | |||
| 2408 | const styles = StyleSheet.create({ | 2418 | const styles = StyleSheet.create({ |
| 2409 | container: { | 2419 | container: { |
| 2410 | padding: 24, | 2420 | padding: 24, |
| 2411 | - backgroundColor: 'white', | 2421 | + backgroundColor: "white", |
| 2412 | flex: 1, | 2422 | flex: 1, |
| 2413 | }, | 2423 | }, |
| 2414 | header: { | 2424 | header: { |
| 2415 | fontSize: 20, | 2425 | fontSize: 20, |
| 2416 | - fontWeight: 'bold', | 2426 | + fontWeight: "bold", |
| 2417 | marginBottom: 12, | 2427 | marginBottom: 12, |
| 2418 | }, | 2428 | }, |
| 2419 | item: { | 2429 | item: { |
| @@ -2421,7 +2431,6 @@ const styles = StyleSheet.create({ | |||
| 2421 | marginBottom: 8, | 2431 | marginBottom: 8, |
| 2422 | }, | 2432 | }, |
| 2423 | }); | 2433 | }); |
| 2424 | - | ||
| 2425 | ``` | 2434 | ``` |
| 2426 | 2435 | ||
| 2427 | ## Native侧集成react_native_breakpoints库 | 2436 | ## Native侧集成react_native_breakpoints库 |
| @@ -2432,6 +2441,7 @@ native侧使用本地依赖的方式直接引入har包。 | |||
| 2432 | ```json | 2441 | ```json |
| 2433 | "@hadss/react_native_breakpoints": "file:../../../GuideJS/node_modules/@hadss/react_native_breakpoints/harmony/breakpoints.har" | 2442 | "@hadss/react_native_breakpoints": "file:../../../GuideJS/node_modules/@hadss/react_native_breakpoints/harmony/breakpoints.har" |
| 2434 | ``` | 2443 | ``` |
| 2444 | + | ||
| 2435 |  | 2445 |  |
| 2436 | 2446 | ||
| 2437 | 由于 react_native_breakpoints 使用了 codegen 自动生成代码,因此要在 `GuidePro/harmony/entry/src/main/cpp/CMakeLists.txt` 中配置相关文件,确保生成的代码被编译进去,配置如下: | 2447 | 由于 react_native_breakpoints 使用了 codegen 自动生成代码,因此要在 `GuidePro/harmony/entry/src/main/cpp/CMakeLists.txt` 中配置相关文件,确保生成的代码被编译进去,配置如下: |
| @@ -2482,7 +2492,6 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { | |||
| 2482 | new BreakpointsModulePackage(ctx), | 2492 | new BreakpointsModulePackage(ctx), |
| 2483 | ]; | 2493 | ]; |
| 2484 | } | 2494 | } |
| 2485 | - | ||
| 2486 | ``` | 2495 | ``` |
| 2487 | 2496 | ||
| 2488 |  | 2497 |  |
| @@ -510,7 +510,7 @@ | |||
| 510 | 二、编译rnoh release | 510 | 二、编译rnoh release |
| 511 | 511 | ||
| 512 | 1. 解压华为公司提供的react_native_openharmony_release-x.x.x.xxx.har。 | 512 | 1. 解压华为公司提供的react_native_openharmony_release-x.x.x.xxx.har。 |
| 513 | -2. 将解压后的src/main/include⽂件夹复制粘贴到新模块。 | 513 | +2. 将解压后的 `include/` 文件夹复制粘贴到新模块。 |
| 514 | 3. 修改新模块的src/main/cpp/CMakeLists.txt。 | 514 | 3. 修改新模块的src/main/cpp/CMakeLists.txt。 |
| 515 | 4. 修改新模块的build-profile.json5。 | 515 | 4. 修改新模块的build-profile.json5。 |
| 516 | 516 | ||
| @@ -254,6 +254,30 @@ This is allowed only when policy CMP0079 is set to NEW. | |||
| 254 | target_link_libraries(xxx PUBLIC ${folly_compile_options}) | 254 | target_link_libraries(xxx PUBLIC ${folly_compile_options}) |
| 255 | ``` | 255 | ``` |
| 256 | 256 | ||
| 257 | +## Release版本编译报找不到 fast_float / folly / hermes 等第三方头文件 | ||
| 258 | + | ||
| 259 | +**问题现象** | ||
| 260 | + | ||
| 261 | +使用 release / release2 HAR 编译时出现类似错误: | ||
| 262 | + | ||
| 263 | +- `fatal error: 'fast_float/fast_float.h' file not found` | ||
| 264 | +- 或 `folly/...`、`hermes/hermes.h` 等第三方头文件找不到 | ||
| 265 | + | ||
| 266 | +**问题原因** | ||
| 267 | + | ||
| 268 | +Release 包将 C++ 源码预编译为 `.so`,公共头文件放在 HAR 的 `include/` 下(含 `include/third-party/fast_float/include` 等)。若 `CMakeLists.txt` 仍按 Debug 方式 `add_subdirectory(src/main/cpp)`,或未 `include(react-native-harmony.cmake)`,就不会带上这些头文件搜索路径。 | ||
| 269 | + | ||
| 270 | +**解决措施** | ||
| 271 | + | ||
| 272 | +1. 确认 `RNOH_CPP_DIR` 指向 `oh_modules/@rnoh/react-native-openharmony/include`(不是 `src/main/cpp`)。 | ||
| 273 | +2. 使用文档推荐方式引入统一配置: | ||
| 274 | + ```cmake | ||
| 275 | + include("${RNOH_CPP_DIR}/react-native-harmony.cmake") | ||
| 276 | + ``` | ||
| 277 | + 该 cmake 已包含 `third-party/fast_float/include`、`folly`、`hermes` 等路径。 | ||
| 278 | +3. 删除 `entry/oh_modules`、清理 `.cxx`/`build` 后执行 **Sync and Refresh Project** 再编译。 | ||
| 279 | +4. 若三方库仍缺头文件,再到 `include/` 下定位对应路径,补充到该库自己的 `include_directories`(参见下一节 hermes 示例)。 | ||
| 280 | + | ||
| 257 | ## Release版本编译报找不到<hermes/hermes.h>头文件 | 281 | ## Release版本编译报找不到<hermes/hermes.h>头文件 |
| 258 | 282 | ||
| 259 | - 现象 | 283 | - 现象 |
| @@ -266,7 +290,7 @@ target_link_libraries(xxx PUBLIC ${folly_compile_options}) | |||
| 266 | 290 | ||
| 267 | - 解决 | 291 | - 解决 |
| 268 | 292 | ||
| 269 | - 在Release版本的RNOH中,头文件已全部抽取出来并放到了 `src/main/include` 文件夹下,如果遇到上述错误,可到 `include` 文件夹下找到对应的文件,并将其路径配置在 `CMakeLists.txt` 的 **include_directories** 里面。例如,对于上述问题,修复方案是: | 293 | + 在 Release 版本的 RNOH 中,头文件已全部抽取到 HAR 的 `include` 目录下(`oh_modules/@rnoh/react-native-openharmony/include`)。如果遇到上述错误,可到该目录下找到对应文件,并将其路径配置在 `CMakeLists.txt` 的 **include_directories** 里面。例如,对于上述问题,修复方案是: |
| 270 | 294 | ||
| 271 | ```diff | 295 | ```diff |
| 272 | # 添加头文件目录 | 296 | # 添加头文件目录 |
| @@ -6,12 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | ## 问题定位AI Skill总览 | 7 | ## 问题定位AI Skill总览 |
| 8 | 8 | ||
| 9 | -| 问题类型 | Skill名称 | 适用场景 | | 9 | +| 问题类型 | Skill名称 | 适用场景 | |
| 10 | -| -------- | --------- | -------- | | 10 | +| -------------- | -------------------------- | ----------------------------------- | |
| 11 | -| 稳定性类问题 | rnoh-stability-triage | 崩溃、冻屏、内存异常、资源泄漏等 | | 11 | +| 稳定性类问题 | rnoh-stability-triage | 崩溃、冻屏、内存异常、资源泄漏等 | |
| 12 | -| 稳定性代码检视 | rnoh-stability-review | 代码层面的稳定性风险预判 | | 12 | +| 稳定性代码检视 | rnoh-stability-review | 代码层面的稳定性风险预判 | |
| 13 | -| 性能类问题 | rnoh-performance-diagnosis | 渲染卡顿、启动慢、内存占用高等 | | 13 | +| 性能类问题 | rnoh-performance-diagnosis | 渲染卡顿、启动慢、内存占用高等 | |
| 14 | -| 功能类问题 | rnoh-feature-diagnosis | 功能异常、API不生效、组件行为异常等 | | 14 | +| 功能类问题 | rnoh-feature-diagnosis | 功能异常、API不生效、组件行为异常等 | |
| 15 | 15 | ||
| 16 | --- | 16 | --- |
| 17 | 17 | ||
| @@ -33,16 +33,19 @@ | |||
| 33 | 在使用AI辅助定位前,请准备好以下信息: | 33 | 在使用AI辅助定位前,请准备好以下信息: |
| 34 | 34 | ||
| 35 | 1. **崩溃日志** | 35 | 1. **崩溃日志** |
| 36 | + | ||
| 36 | - FaultLog、CppCrash日志 | 37 | - FaultLog、CppCrash日志 |
| 37 | - native backtrace | 38 | - native backtrace |
| 38 | - JS异常栈(如果是JS Crash) | 39 | - JS异常栈(如果是JS Crash) |
| 39 | 40 | ||
| 40 | 2. **版本信息** | 41 | 2. **版本信息** |
| 41 | - - RNOH版本号(如 0.72.53、0.77.18、0.82.3、0.84.1、0.86.1) | 42 | + |
| 43 | + - RNOH版本号(如 0.72.53、0.77.18、0.82.3、0.84.1、0.88.1) | ||
| 42 | - React Native版本 | 44 | - React Native版本 |
| 43 | - HarmonyOS API Level | 45 | - HarmonyOS API Level |
| 44 | 46 | ||
| 45 | 3. **触发场景** | 47 | 3. **触发场景** |
| 48 | + | ||
| 46 | - 启动阶段、页面切换、实例销毁、动画执行、图片加载等 | 49 | - 启动阶段、页面切换、实例销毁、动画执行、图片加载等 |
| 47 | 50 | ||
| 48 | 4. **运行日志** | 51 | 4. **运行日志** |
| @@ -57,6 +60,7 @@ | |||
| 57 | **第一步:提取问题画像** | 60 | **第一步:提取问题画像** |
| 58 | 61 | ||
| 59 | AI会从日志中提取以下五元组: | 62 | AI会从日志中提取以下五元组: |
| 63 | + | ||
| 60 | - 现象:闪退/卡死/OOM/泄漏 | 64 | - 现象:闪退/卡死/OOM/泄漏 |
| 61 | - 类别:应用异常退出/应用冻屏/内存异常/资源泄漏 | 65 | - 类别:应用异常退出/应用冻屏/内存异常/资源泄漏 |
| 62 | - 线程或错误:JS线程、主线程、SIGSEGV等 | 66 | - 线程或错误:JS线程、主线程、SIGSEGV等 |
| @@ -66,6 +70,7 @@ AI会从日志中提取以下五元组: | |||
| 66 | **第二步:历史修复匹配** | 70 | **第二步:历史修复匹配** |
| 67 | 71 | ||
| 68 | AI会优先检查历史稳定性修复汇总,判断问题是否已在后续版本修复: | 72 | AI会优先检查历史稳定性修复汇总,判断问题是否已在后续版本修复: |
| 73 | + | ||
| 69 | - 0.72稳定性修复汇总(约95条) | 74 | - 0.72稳定性修复汇总(约95条) |
| 70 | - 0.77稳定性修复汇总(约42条) | 75 | - 0.77稳定性修复汇总(约42条) |
| 71 | - 0.82稳定性修复汇总(约19条) | 76 | - 0.82稳定性修复汇总(约19条) |
| @@ -73,6 +78,7 @@ AI会优先检查历史稳定性修复汇总,判断问题是否已在后续版 | |||
| 73 | **第三步:归因判断** | 78 | **第三步:归因判断** |
| 74 | 79 | ||
| 75 | AI会给出三类归因结果: | 80 | AI会给出三类归因结果: |
| 81 | + | ||
| 76 | - 更像框架问题 | 82 | - 更像框架问题 |
| 77 | - 更像用户代码问题 | 83 | - 更像用户代码问题 |
| 78 | - 暂时无法定性(需补充信息) | 84 | - 暂时无法定性(需补充信息) |
| @@ -80,6 +86,7 @@ AI会给出三类归因结果: | |||
| 80 | ### 1.4 使用示例 | 86 | ### 1.4 使用示例 |
| 81 | 87 | ||
| 82 | **输入示例:** | 88 | **输入示例:** |
| 89 | + | ||
| 83 | ``` | 90 | ``` |
| 84 | 使用rnoh-stability-triage分析以下崩溃: | 91 | 使用rnoh-stability-triage分析以下崩溃: |
| 85 | 92 | ||
| @@ -123,11 +130,13 @@ MR:[!1985](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1985) | |||
| 123 | 如需在代码层面预判稳定性风险,使用 `rnoh-stability-review` skill: | 130 | 如需在代码层面预判稳定性风险,使用 `rnoh-stability-review` skill: |
| 124 | 131 | ||
| 125 | **适用场景:** | 132 | **适用场景:** |
| 133 | + | ||
| 126 | - PR提交前自查 | 134 | - PR提交前自查 |
| 127 | - 代码评审时系统检查 | 135 | - 代码评审时系统检查 |
| 128 | - 已定位到可疑模块,需在代码层面确认 | 136 | - 已定位到可疑模块,需在代码层面确认 |
| 129 | 137 | ||
| 130 | **检视分类:** | 138 | **检视分类:** |
| 139 | + | ||
| 131 | - A:应用异常退出风险(销毁后访问、初始化时序、noexcept滥用等) | 140 | - A:应用异常退出风险(销毁后访问、初始化时序、noexcept滥用等) |
| 132 | - B:应用冻屏风险(锁顺序、锁重入、持锁回调等) | 141 | - B:应用冻屏风险(锁顺序、锁重入、持锁回调等) |
| 133 | - C:内存异常风险(循环引用、UAF典型路径等) | 142 | - C:内存异常风险(循环引用、UAF典型路径等) |
| @@ -151,23 +160,25 @@ MR:[!1985](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1985) | |||
| 151 | 160 | ||
| 152 | ### 2.2 问题分类 | 161 | ### 2.2 问题分类 |
| 153 | 162 | ||
| 154 | -| 类别 | 典型现象 | 定位重点 | | 163 | +| 类别 | 典型现象 | 定位重点 | |
| 155 | -| ---- | -------- | -------- | | 164 | +| -------- | -------------------- | ------------------------------- | |
| 156 | -| 渲染性能 | UI卡顿、掉帧、动画卡 | 布局耗时、组件层级、重渲染 | | 165 | +| 渲染性能 | UI卡顿、掉帧、动画卡 | 布局耗时、组件层级、重渲染 | |
| 157 | -| 启动性能 | 冷启动慢、首屏加载慢 | Bundle加载、初始化链路、预加载 | | 166 | +| 启动性能 | 冷启动慢、首屏加载慢 | Bundle加载、初始化链路、预加载 | |
| 158 | -| 内存性能 | 内存占用高、OOM | 对象持有、缓存策略、图片资源 | | 167 | +| 内存性能 | 内存占用高、OOM | 对象持有、缓存策略、图片资源 | |
| 159 | -| 列表性能 | 滑动卡顿、列表加载慢 | renderItem复杂度、虚拟列表配置 | | 168 | +| 列表性能 | 滑动卡顿、列表加载慢 | renderItem复杂度、虚拟列表配置 | |
| 160 | -| 通信性能 | JS-Native交互慢 | TurboModule调用频率、序列化开销 | | 169 | +| 通信性能 | JS-Native交互慢 | TurboModule调用频率、序列化开销 | |
| 161 | 170 | ||
| 162 | ### 2.3 最小必要输入 | 171 | ### 2.3 最小必要输入 |
| 163 | 172 | ||
| 164 | 1. **性能数据** | 173 | 1. **性能数据** |
| 174 | + | ||
| 165 | - trace分析结果 | 175 | - trace分析结果 |
| 166 | - -帧率数据(FPS) | 176 | + - 帧率数据(FPS) |
| 167 | - 内存占用曲线 | 177 | - 内存占用曲线 |
| 168 | - CPU使用率 | 178 | - CPU使用率 |
| 169 | 179 | ||
| 170 | 2. **场景描述** | 180 | 2. **场景描述** |
| 181 | + | ||
| 171 | - 问题发生的具体页面/组件 | 182 | - 问题发生的具体页面/组件 |
| 172 | - 操作序列(如:进入页面→滚动列表→退出) | 183 | - 操作序列(如:进入页面→滚动列表→退出) |
| 173 | - 预期vs实际表现 | 184 | - 预期vs实际表现 |
| @@ -186,11 +197,13 @@ MR:[!1985](https://gitcode.com/CPF-RN/ohos_react_native/merge_requests/1985) | |||
| 186 | **第一步:性能归类** | 197 | **第一步:性能归类** |
| 187 | 198 | ||
| 188 | AI根据现象判断属于哪类性能问题: | 199 | AI根据现象判断属于哪类性能问题: |
| 200 | + | ||
| 189 | - 渲染类、启动类、内存类、列表类、通信类 | 201 | - 渲染类、启动类、内存类、列表类、通信类 |
| 190 | 202 | ||
| 191 | **第二步:热点识别** | 203 | **第二步:热点识别** |
| 192 | 204 | ||
| 193 | AI识别可能的性能热点: | 205 | AI识别可能的性能热点: |
| 206 | + | ||
| 194 | - 布局计算频繁 | 207 | - 布局计算频繁 |
| 195 | - 重渲染触发过多 | 208 | - 重渲染触发过多 |
| 196 | - 对象创建/销毁频繁 | 209 | - 对象创建/销毁频繁 |
| @@ -199,23 +212,25 @@ AI识别可能的性能热点: | |||
| 199 | **第三步:根因推断** | 212 | **第三步:根因推断** |
| 200 | 213 | ||
| 201 | AI分析可能的根因: | 214 | AI分析可能的根因: |
| 215 | + | ||
| 202 | - 组件设计问题(如深层嵌套、复杂shouldComponentUpdate) | 216 | - 组件设计问题(如深层嵌套、复杂shouldComponentUpdate) |
| 203 | - 配置问题(如列表未使用虚拟化、图片未压缩) | 217 | - 配置问题(如列表未使用虚拟化、图片未压缩) |
| 204 | - 通信问题(如频繁同步调用TurboModule) | 218 | - 通信问题(如频繁同步调用TurboModule) |
| 205 | 219 | ||
| 206 | ### 2.5 常见性能问题与解决方案 | 220 | ### 2.5 常见性能问题与解决方案 |
| 207 | 221 | ||
| 208 | -| 问题 | 常见根因 | 解决方案 | | 222 | +| 问题 | 常见根因 | 解决方案 | |
| 209 | -| ---- | -------- | -------- | | 223 | +| ------------ | ------------------------------ | -------------------------------------------------------------- | |
| 210 | -| 页面渲染卡顿 | 组件层级过深、频繁重渲染 | 减少层级、使用memo/shouldComponentUpdate、避免在渲染中创建对象 | | 224 | +| 页面渲染卡顿 | 组件层级过深、频繁重渲染 | 减少层级、使用memo/shouldComponentUpdate、避免在渲染中创建对象 | |
| 211 | -| 列表滑动卡顿 | renderItem复杂、未使用虚拟列表 | 使用FlashList/FlatList、优化renderItem、设置正确的windowSize | | 225 | +| 列表滑动卡顿 | renderItem复杂、未使用虚拟列表 | 使用FlashList/FlatList、优化renderItem、设置正确的windowSize | |
| 212 | -| 启动慢 | Bundle过大、初始化链路长 | 使用HBC字节码、预加载、延迟加载非关键模块 | | 226 | +| 启动慢 | Bundle过大、初始化链路长 | 使用HBC字节码、预加载、延迟加载非关键模块 | |
| 213 | -| 图片加载慢 | 图片未压缩、未使用缓存 | 压缩图片、使用图片缓存、预加载关键图片 | | 227 | +| 图片加载慢 | 图片未压缩、未使用缓存 | 压缩图片、使用图片缓存、预加载关键图片 | |
| 214 | -| 动画卡顿 | useNativeDriver=false | 使用useNativeDriver=true、用transform代替top/left | | 228 | +| 动画卡顿 | useNativeDriver=false | 使用useNativeDriver=true、用transform代替top/left | |
| 215 | 229 | ||
| 216 | ### 2.6 使用示例 | 230 | ### 2.6 使用示例 |
| 217 | 231 | ||
| 218 | **输入示例:** | 232 | **输入示例:** |
| 233 | + | ||
| 219 | ``` | 234 | ``` |
| 220 | 使用rnoh-performance-diagnosis分析: | 235 | 使用rnoh-performance-diagnosis分析: |
| 221 | 236 | ||
| @@ -229,7 +244,7 @@ AI分析可能的根因: | |||
| 229 | 244 | ||
| 230 | **输出格式:** | 245 | **输出格式:** |
| 231 | 246 | ||
| 232 | -``` | 247 | +```` |
| 233 | # 性能问题分析 | 248 | # 性能问题分析 |
| 234 | 249 | ||
| 235 | ## 1. 性能归类 | 250 | ## 1. 性能归类 |
| @@ -261,7 +276,8 @@ AI分析可能的根因: | |||
| 261 | ``` | 276 | ``` |
| 262 | 277 | ||
| 263 | 3. 考虑使用FlashList替代FlatList(性能更优) | 278 | 3. 考虑使用FlashList替代FlatList(性能更优) |
| 264 | -``` | 279 | + |
| 280 | +```` | ||
| 265 | 281 | ||
| 266 | --- | 282 | --- |
| 267 | 283 | ||
| @@ -306,7 +322,9 @@ AI分析可能的根因: | |||
| 306 | ### 3.4 AI分析流程 | 322 | ### 3.4 AI分析流程 |
| 307 | 323 | ||
| 308 | ``` | 324 | ``` |
| 325 | + | ||
| 309 | 问题描述 → 功能归类 → 规格对照 → 代码检查 → 原因判断 → 解决方案 | 326 | 问题描述 → 功能归类 → 规格对照 → 代码检查 → 原因判断 → 解决方案 |
| 327 | + | ||
| 310 | ``` | 328 | ``` |
| 311 | 329 | ||
| 312 | **第一步:功能归类** | 330 | **第一步:功能归类** |
| @@ -343,6 +361,7 @@ AI检查可能的代码问题: | |||
| 343 | 361 | ||
| 344 | **输入示例:** | 362 | **输入示例:** |
| 345 | ``` | 363 | ``` |
| 364 | + | ||
| 346 | 使用rnoh-feature-diagnosis分析: | 365 | 使用rnoh-feature-diagnosis分析: |
| 347 | 366 | ||
| 348 | 问题:StatusBar.setBackgroundColor('#FF0000') 设置不生效 | 367 | 问题:StatusBar.setBackgroundColor('#FF0000') 设置不生效 |
| @@ -352,47 +371,57 @@ AI检查可能的代码问题: | |||
| 352 | 版本:0.77 | 371 | 版本:0.77 |
| 353 | 代码: | 372 | 代码: |
| 354 | StatusBar.setBackgroundColor('#FF0000', true); | 373 | StatusBar.setBackgroundColor('#FF0000', true); |
| 374 | + | ||
| 355 | ``` | 375 | ``` |
| 356 | 376 | ||
| 357 | **输出格式:** | 377 | **输出格式:** |
| 358 | 378 | ||
| 359 | -``` | 379 | +```` |
| 360 | # 功能问题分析 | 380 | # 功能问题分析 |
| 361 | 381 | ||
| 362 | ## 1. 功能归类 | 382 | ## 1. 功能归类 |
| 383 | + | ||
| 363 | 类别:平台类问题 | 384 | 类别:平台类问题 |
| 364 | 具体:StatusBar平台差异 | 385 | 具体:StatusBar平台差异 |
| 365 | 386 | ||
| 366 | ## 2. 规格说明 | 387 | ## 2. 规格说明 |
| 388 | + | ||
| 367 | HarmonyOS的StatusBar属于系统级UI能力: | 389 | HarmonyOS的StatusBar属于系统级UI能力: |
| 390 | + | ||
| 368 | - 状态栏配置由系统统一管理 | 391 | - 状态栏配置由系统统一管理 |
| 369 | - 不与单个页面生命周期绑定 | 392 | - 不与单个页面生命周期绑定 |
| 370 | - 页面切换后样式不会自动回退 | 393 | - 页面切换后样式不会自动回退 |
| 371 | 394 | ||
| 372 | ## 3. 原因判断 | 395 | ## 3. 原因判断 |
| 396 | + | ||
| 373 | 非代码问题,属于平台能力差异: | 397 | 非代码问题,属于平台能力差异: |
| 398 | + | ||
| 374 | - StatusBar.setBackgroundColor可以生效 | 399 | - StatusBar.setBackgroundColor可以生效 |
| 375 | - 但页面切换后样式不会自动恢复 | 400 | - 但页面切换后样式不会自动恢复 |
| 376 | - 需要手动管理状态栏状态 | 401 | - 需要手动管理状态栏状态 |
| 377 | 402 | ||
| 378 | ## 4. 解决方案 | 403 | ## 4. 解决方案 |
| 404 | + | ||
| 379 | 1. 封装跨平台StatusBar管理组件: | 405 | 1. 封装跨平台StatusBar管理组件: |
| 406 | + | ||
| 380 | ```tsx | 407 | ```tsx |
| 381 | // 推荐封装 | 408 | // 推荐封装 |
| 382 | - if (Platform.OS === 'harmony') { | 409 | + if (Platform.OS === "harmony") { |
| 383 | // HarmonyOS:不使用StatusBar,或手动管理 | 410 | // HarmonyOS:不使用StatusBar,或手动管理 |
| 384 | } else { | 411 | } else { |
| 385 | - StatusBar.setBackgroundColor('#FF0000', true); | 412 | + StatusBar.setBackgroundColor("#FF0000", true); |
| 386 | } | 413 | } |
| 387 | ``` | 414 | ``` |
| 388 | 415 | ||
| 389 | 2. 在页面切换时手动重置: | 416 | 2. 在页面切换时手动重置: |
| 417 | + | ||
| 390 | - 进入页面时设置目标样式 | 418 | - 进入页面时设置目标样式 |
| 391 | - 退出页面时恢复默认样式 | 419 | - 退出页面时恢复默认样式 |
| 392 | 420 | ||
| 393 | 3. 参考文档: | 421 | 3. 参考文档: |
| 394 | - [RN StatusBar在HarmonyOS上的行为说明](../02-开发/03-场景与实践/使用类FAQ.md#rn中statusbar作用域问题) | 422 | - [RN StatusBar在HarmonyOS上的行为说明](../02-开发/03-场景与实践/使用类FAQ.md#rn中statusbar作用域问题) |
| 395 | -``` | 423 | + |
| 424 | +```` | ||
| 396 | 425 | ||
| 397 | --- | 426 | --- |
| 398 | 427 | ||
| @@ -417,9 +446,11 @@ HarmonyOS的StatusBar属于系统级UI能力: | |||
| 417 | ### 4.3 问题定位流程图 | 446 | ### 4.3 问题定位流程图 |
| 418 | 447 | ||
| 419 | ``` | 448 | ``` |
| 449 | + | ||
| 420 | 问题发现 → 确定问题类型 → 准备必要信息 → 使用对应Skill → AI分析 → 验证结论 → 执行修复 | 450 | 问题发现 → 确定问题类型 → 准备必要信息 → 使用对应Skill → AI分析 → 验证结论 → 执行修复 |
| 421 | ↓ ↓ | 451 | ↓ ↓ |
| 422 | 稳定性/性能/功能 补充信息继续分析 | 452 | 稳定性/性能/功能 补充信息继续分析 |
| 453 | + | ||
| 423 | ``` | 454 | ``` |
| 424 | 455 | ||
| 425 | --- | 456 | --- |
| @@ -430,4 +461,5 @@ HarmonyOS的StatusBar属于系统级UI能力: | |||
| 430 | - [稳定性分析方法](./稳定性问题介绍/稳定性分析方法.md) | 461 | - [稳定性分析方法](./稳定性问题介绍/稳定性分析方法.md) |
| 431 | - [稳定性案例](./稳定性问题介绍/稳定性案例.md) | 462 | - [稳定性案例](./稳定性问题介绍/稳定性案例.md) |
| 432 | - [性能调优](../04-调优/性能调优.md) | 463 | - [性能调优](../04-调优/性能调优.md) |
| 433 | -- [使用类FAQ](../02-开发/03-场景与实践/使用类FAQ.md) | 464 | +- [使用类FAQ](../02-开发/03-场景与实践/使用类FAQ.md) |
| 465 | + | ||
| @@ -48,7 +48,7 @@ | |||
| 48 | ├── AI辅助问题定位指导.md # AI诊断 | 48 | ├── AI辅助问题定位指导.md # AI诊断 |
| 49 | │ | 49 | │ |
| 50 | ├── release-notes/ # 各版本详细说明 ⚡版本相关 | 50 | ├── release-notes/ # 各版本详细说明 ⚡版本相关 |
| 51 | -│ └── react-native-harmony-v0.86.1.md | 51 | +│ └── react-native-harmony-v0.88.1.md |
| 52 | │ | 52 | │ |
| 53 | ├── ../../../.agents/skills/rnoh-upgrade/ # 发版文档同步 Skill(位于 .agents/skills/) | 53 | ├── ../../../.agents/skills/rnoh-upgrade/ # 发版文档同步 Skill(位于 .agents/skills/) |
| 54 | │ | 54 | │ |
| @@ -0,0 +1,46 @@ | |||
| 1 | +# React Native 鸿蒙化版本信息 | ||
| 2 | + | ||
| 3 | +当前React Native鸿蒙版本基于**社区RN 0.88.1**进行适配,发布版本信息如下: | ||
| 4 | + | ||
| 5 | +## 版本发布信息 | ||
| 6 | + | ||
| 7 | +| 名称 | 版本号 | 版本类型 | npm地址 | | ||
| 8 | +| ---------------------------- | ------ | -------- | ------------ | | ||
| 9 | +| react-native-harmony.tgz | 0.88.1 | beta | 内部转测版本 | | ||
| 10 | +| react-native-harmony-cli.tgz | 0.88.1 | beta | 内部转测版本 | | ||
| 11 | + | ||
| 12 | +## 配套版本信息 | ||
| 13 | + | ||
| 14 | +| 名称 | 版本号 | | ||
| 15 | +| ------------------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| 16 | +| DevEco Studio | [DevEco Studio 26.0.0 Release](https://developer.huawei.com/consumer/cn/download/deveco-studio) | | ||
| 17 | +| HarmonyOS SDK / ROM | HarmonyOS 26.0.0(API 26)及兼容该目标 SDK 的设备 ROM | | ||
| 18 | +| Command Line Tools | [Command Line Tools 26.0.0 Release](https://developer.huawei.com/consumer/cn/download/command-line-tools-for-hmos) | | ||
| 19 | +| Node.js | >=22.11.0,与上游 0.86.0 → 0.88.1 升级模板保持一致 | | ||
| 20 | + | ||
| 21 | +## 源码发布地址 | ||
| 22 | + | ||
| 23 | +- GitCode: [https://gitcode.com/CPF-RN/ohos_react_native](https://gitcode.com/CPF-RN/ohos_react_native) | ||
| 24 | + | ||
| 25 | +## 目标版本要求 | ||
| 26 | + | ||
| 27 | +> 该 React Native 鸿蒙化版本的目标 OpenHarmony SDK 版本为 API 26。配套版本说明请参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-releases/deveco-studio-new-features-2600 | ||
| 28 | + | ||
| 29 | +## 最低版本要求 | ||
| 30 | + | ||
| 31 | +> 仓库模板将 `compatibleSdkVersion` 设置为 `5.0.0(12)`,将 `targetSdkVersion` 设置为 `26.0.0`。编译 SDK 和设备 ROM 需要在目标 DevEco/设备矩阵中实际选择并验证;本文不对所有 API 或 ROM 组合做认证。 | ||
| 32 | + | ||
| 33 | +## 兼容性说明 | ||
| 34 | + | ||
| 35 | +> 仓库模板以 API 26 作为目标 SDK。更低 API 或不同 ROM 的可用性需要结合目标应用进行验证,不能据此推导为统一兼容范围。 | ||
| 36 | + | ||
| 37 | +## 变更说明 | ||
| 38 | + | ||
| 39 | +- **新增特性:** | ||
| 40 | + - 对齐上游 React Native 0.88.1:默认启用 Web-based event dispatching、`fontVariationSettings` 可变字体、React 19.3.0 与对应 Metro 基线等能力。 | ||
| 41 | +- **兼容性提醒:** | ||
| 42 | + - 从 0.86 升级到 0.88 的依赖与工程步骤,详见 [版本升级指导](../版本升级指导.md#从-086x-升级到-088x)。 | ||
| 43 | +- **工具链配套:** | ||
| 44 | + - 仓库基线为 DevEco Studio 26.0.0 / HarmonyOS SDK 26.0.0 / Command Line Tools 26.0.0;模板设置 `compatibleSdkVersion` 5.0.0(12)、`targetSdkVersion` 26.0.0。发布前请在实际 ROM 和设备上验证。 | ||
| 45 | + | ||
| 46 | +完整变更记录见仓库根目录 `CHANGELOG.md`(随发版更新)。 | ||
| @@ -1,9 +1,9 @@ | |||
| 1 | This documentation is based on React Native documentation licensed under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license at | 1 | This documentation is based on React Native documentation licensed under the [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) license at |
| 2 | -https://reactnative.cn/docs/0.86/flexbox | 2 | +https://reactnative.cn/docs/0.88/flexbox |
| 3 | -https://reactnative.cn/docs/0.86/platform | 3 | +https://reactnative.cn/docs/0.88/platform |
| 4 | -https://reactnative.cn/docs/0.86/pixelratio | 4 | +https://reactnative.cn/docs/0.88/pixelratio |
| 5 | -https://reactnative.cn/docs/0.86/dimensions | 5 | +https://reactnative.cn/docs/0.88/dimensions |
| 6 | -https://reactnative.cn/docs/0.86/usewindowdimensions | 6 | +https://reactnative.cn/docs/0.88/usewindowdimensions |
| 7 | © Meta Platforms Inc. | 7 | © Meta Platforms Inc. |
| 8 | 8 | ||
| 9 | # RN框架多屏适配指导 | 9 | # RN框架多屏适配指导 |
| @@ -16,7 +16,7 @@ https://reactnative.cn/docs/0.86/usewindowdimensions | |||
| 16 | 16 | ||
| 17 | ## Flexbox布局 | 17 | ## Flexbox布局 |
| 18 | 18 | ||
| 19 | -**官方文档介绍:[使用Flexbox布局](https://reactnative.cn/docs/0.86/flexbox)** | 19 | +**官方文档介绍:[使用Flexbox布局](https://reactnative.cn/docs/0.88/flexbox)** |
| 20 | 20 | ||
| 21 | 弹性盒(Flexbox)是一种CSS布局模型,旨在为网页提供灵活的、自适应的排列方式。它通过定义容器和内部项目的行为,使得页面元素能够以可预测的方式在容器中进行排列和分布。在React Native中使用Flexbox规则来指定某个组件的子元素的布局。Flexbox可以在不同屏幕尺寸上提供一致的布局结构。React Native中的Flexbox的工作原理和web上的CSS基本一致,也存在少许差异,详细差异点请参考官方文档。 | 21 | 弹性盒(Flexbox)是一种CSS布局模型,旨在为网页提供灵活的、自适应的排列方式。它通过定义容器和内部项目的行为,使得页面元素能够以可预测的方式在容器中进行排列和分布。在React Native中使用Flexbox规则来指定某个组件的子元素的布局。Flexbox可以在不同屏幕尺寸上提供一致的布局结构。React Native中的Flexbox的工作原理和web上的CSS基本一致,也存在少许差异,详细差异点请参考官方文档。 |
| 22 | 22 | ||
| @@ -52,13 +52,13 @@ https://reactnative.cn/docs/0.86/usewindowdimensions | |||
| 52 | - `space-around` 在容器的主轴上均匀分布子元素,将剩余空间围绕在每个子元素周围。与 `space-between` 相比,使用 `space-around` 会导致空间被分配到第一个子元素和最后一个子元素之前和之后。 | 52 | - `space-around` 在容器的主轴上均匀分布子元素,将剩余空间围绕在每个子元素周围。与 `space-between` 相比,使用 `space-around` 会导致空间被分配到第一个子元素和最后一个子元素之前和之后。 |
| 53 | - `space-evenly` 在对齐容器内沿着主轴均匀分布子项。每一对相邻项、主开始边缘和第一项以及主结束边缘和最后一项之间的间距都完全相同。 | 53 | - `space-evenly` 在对齐容器内沿着主轴均匀分布子项。每一对相邻项、主开始边缘和第一项以及主结束边缘和最后一项之间的间距都完全相同。 |
| 54 | 54 | ||
| 55 | -更多的布局属性及示例代码请参考[官方文档](https://reactnative.cn/docs/0.86/flexbox)。 | 55 | +更多的布局属性及示例代码请参考[官方文档](https://reactnative.cn/docs/0.88/flexbox)。 |
| 56 | 56 | ||
| 57 | ## 设备类型+像素密度 | 57 | ## 设备类型+像素密度 |
| 58 | 58 | ||
| 59 | ### isPad、isTV | 59 | ### isPad、isTV |
| 60 | 60 | ||
| 61 | -**官方文档介绍:[Platform API](https://reactnative.cn/docs/0.86/platform#ispad-ios)** | 61 | +**官方文档介绍:[Platform API](https://reactnative.cn/docs/0.88/platform#ispad-ios)** |
| 62 | 62 | ||
| 63 | `Platform API` 中包含了 `isPad` 和 `isTV` 两个方法,它会返回一个布尔值,用于确定当前设备是否为 iPad 或者是否为 TV。 | 63 | `Platform API` 中包含了 `isPad` 和 `isTV` 两个方法,它会返回一个布尔值,用于确定当前设备是否为 iPad 或者是否为 TV。 |
| 64 | 64 | ||
| @@ -66,7 +66,7 @@ https://reactnative.cn/docs/0.86/usewindowdimensions | |||
| 66 | 66 | ||
| 67 | ### PixelRatio | 67 | ### PixelRatio |
| 68 | 68 | ||
| 69 | -**官方文档介绍:[PixelRatio API](https://reactnative.cn/docs/0.86/pixelratio)** | 69 | +**官方文档介绍:[PixelRatio API](https://reactnative.cn/docs/0.88/pixelratio)** |
| 70 | 70 | ||
| 71 | `PixelRatio` 可以获取到设备的像素密度和字体缩放比。 | 71 | `PixelRatio` 可以获取到设备的像素密度和字体缩放比。 |
| 72 | 72 | ||
| @@ -127,7 +127,7 @@ const image = getImage({ | |||
| 127 | 127 | ||
| 128 | ## Dimensions API | 128 | ## Dimensions API |
| 129 | 129 | ||
| 130 | -**官方文档介绍:[Dimensions API](https://reactnative.cn/docs/0.86/dimensions)** | 130 | +**官方文档介绍:[Dimensions API](https://reactnative.cn/docs/0.88/dimensions)** |
| 131 | 131 | ||
| 132 | 在获取设备屏幕独立像素方面,React Native 提供了 `Dimensions API` 来进行设备信息获取。通过调用 `Dimensions.get()` 方法,可以取得一个包含屏幕长宽信息的对象,来把握当前用户的设备的屏幕大小,并且以此来简易推测用户是否处于横屏状态。 | 132 | 在获取设备屏幕独立像素方面,React Native 提供了 `Dimensions API` 来进行设备信息获取。通过调用 `Dimensions.get()` 方法,可以取得一个包含屏幕长宽信息的对象,来把握当前用户的设备的屏幕大小,并且以此来简易推测用户是否处于横屏状态。 |
| 133 | 133 | ||
| @@ -154,7 +154,7 @@ const windowHeight = Dimensions.get("window").height; | |||
| 154 | 154 | ||
| 155 | 添加一个事件监听函数。目前支持的事件有: | 155 | 添加一个事件监听函数。目前支持的事件有: |
| 156 | 156 | ||
| 157 | - `change`:在 `Dimensions` 对象内部的属性发生变化时触发。事件处理程序的参数是一个[`DimensionsValue`](https://reactnative.cn/docs/0.86/dimensions#dimensionsvalue)类型的对象。 | 157 | + `change`:在 `Dimensions` 对象内部的属性发生变化时触发。事件处理程序的参数是一个[`DimensionsValue`](https://reactnative.cn/docs/0.88/dimensions#dimensionsvalue)类型的对象。 |
| 158 | 158 | ||
| 159 | - `get()` | 159 | - `get()` |
| 160 | 160 | ||
| @@ -168,7 +168,7 @@ const windowHeight = Dimensions.get("window").height; | |||
| 168 | 168 | ||
| 169 | ## useWindowDimensions Hook API | 169 | ## useWindowDimensions Hook API |
| 170 | 170 | ||
| 171 | -**官方文档介绍:[useWindowDimensions](https://reactnative.cn/docs/0.86/usewindowdimensions)** | 171 | +**官方文档介绍:[useWindowDimensions](https://reactnative.cn/docs/0.88/usewindowdimensions)** |
| 172 | 172 | ||
| 173 | `useWindowDimensions` 会根据用户状态栏,虚拟菜单栏,以及用户手机是否横置来返回相应的屏幕长宽。基于该 API 封装多个屏幕断点,可在断点变化时自适应调整界面布局。会在屏幕尺寸变化时自动更新获取到的设备 `width` 和 `height` 值。使用方法如下: | 173 | `useWindowDimensions` 会根据用户状态栏,虚拟菜单栏,以及用户手机是否横置来返回相应的屏幕长宽。基于该 API 封装多个屏幕断点,可在断点变化时自适应调整界面布局。会在屏幕尺寸变化时自动更新获取到的设备 `width` 和 `height` 值。使用方法如下: |
| 174 | 174 | ||
| @@ -215,7 +215,7 @@ const windowHeight = useWindowDimensions().height; | |||
| 215 | 215 | ||
| 216 | ## 如何适配折叠屏 | 216 | ## 如何适配折叠屏 |
| 217 | 217 | ||
| 218 | -如果要考虑可折叠的设备,或者其他屏幕尺寸可变的设备,可以参考下面例子中所使用的事件监听函数或是[`useWindowDimensions`](https://reactnative.cn/docs/0.86/usewindowdimensions): | 218 | +如果要考虑可折叠的设备,或者其他屏幕尺寸可变的设备,可以参考下面例子中所使用的事件监听函数或是[`useWindowDimensions`](https://reactnative.cn/docs/0.88/usewindowdimensions): |
| 219 | 219 | ||
| 220 | 1. 如何感知屏幕的变化 | 220 | 1. 如何感知屏幕的变化 |
| 221 | 221 | ||
| @@ -8,6 +8,7 @@ | |||
| 8 | - [0.77.x → 0.82.x](#从-077x-升级到-082x) | 8 | - [0.77.x → 0.82.x](#从-077x-升级到-082x) |
| 9 | - [0.82.x → 0.84.x](#从-082x-升级到-084x) | 9 | - [0.82.x → 0.84.x](#从-082x-升级到-084x) |
| 10 | - [0.84.x → 0.86.x](#从-084x-升级到-086x) | 10 | - [0.84.x → 0.86.x](#从-084x-升级到-086x) |
| 11 | + - [0.86.x → 0.88.x](#从-086x-升级到-088x) | ||
| 11 | 12 | ||
| 12 | # 小版本升级 | 13 | # 小版本升级 |
| 13 | 14 | ||
| @@ -161,6 +162,7 @@ yarn add @react-native-oh/react-native-harmony@x.x.x @react-native-oh/react-nati | |||
| 161 | - [从 0.77.x 升级到 0.82.x](#从-077x-升级到-082x) | 162 | - [从 0.77.x 升级到 0.82.x](#从-077x-升级到-082x) |
| 162 | - [从 0.82.x 升级到 0.84.x](#从-082x-升级到-084x) | 163 | - [从 0.82.x 升级到 0.84.x](#从-082x-升级到-084x) |
| 163 | - [从 0.84.x 升级到 0.86.x](#从-084x-升级到-086x) | 164 | - [从 0.84.x 升级到 0.86.x](#从-084x-升级到-086x) |
| 165 | +- [从 0.86.x 升级到 0.88.x](#从-086x-升级到-088x) | ||
| 164 | 166 | ||
| 165 | ## 从 0.72.x 升级到 0.77.x | 167 | ## 从 0.72.x 升级到 0.77.x |
| 166 | 168 | ||
| @@ -216,10 +218,10 @@ yarn add @react-native-oh/react-native-harmony@x.x.x @react-native-oh/react-nati | |||
| 216 | - 提示:在VSCode中可以复制所有的 devDependencies 到待升级项目的 devDependencies 中,重复的key会被划线,删掉老的即完成依赖补充和升级 | 218 | - 提示:在VSCode中可以复制所有的 devDependencies 到待升级项目的 devDependencies 中,重复的key会被划线,删掉老的即完成依赖补充和升级 |
| 217 | 219 | ||
| 218 | 2. 升级/添加RNOH前端依赖后,运行`npm i`安装依赖。若遇依赖冲突错误,可根据错误信息调整`package.json`中依赖库的版本来解决 | 220 | 2. 升级/添加RNOH前端依赖后,运行`npm i`安装依赖。若遇依赖冲突错误,可根据错误信息调整`package.json`中依赖库的版本来解决 |
| 219 | - - 升级 dependencies: "react-native-harmony" 或 "@xxx/react-native-harmony" | 221 | + - 升级 dependencies: "react-native-harmony" 或 "@xxx/react-native-harmony" |
| 220 | - >注意:保持原来的包名。如果原来 react-native-harmony 前面没有@组织前缀那么升级时也不要添加,如果原来有就保持之前的 "@xxx/react-native-harmony" | 222 | + > 注意:保持原来的包名。如果原来 react-native-harmony 前面没有@组织前缀那么升级时也不要添加,如果原来有就保持之前的 "@xxx/react-native-harmony" |
| 221 | - - 添加 devDependencies: "@react-native-oh/react-native-harmony-cli" | 223 | + - 添加 devDependencies: "@react-native-oh/react-native-harmony-cli" |
| 222 | - - 具体版本号请参考 [RNOH版本规划](../06-社区/roadmap.md) | 224 | + - 具体版本号请参考 [RNOH版本规划](../06-社区/roadmap.md) |
| 223 | 3. 修改两处配置,其中第二处可选。注意只修改配置中下面列出的字段 | 225 | 3. 修改两处配置,其中第二处可选。注意只修改配置中下面列出的字段 |
| 224 | 226 | ||
| 225 | 1. babel.config.js | 227 | 1. babel.config.js |
| @@ -443,10 +445,10 @@ yarn add @react-native-oh/react-native-harmony@x.x.x @react-native-oh/react-nati | |||
| 443 | ``` | 445 | ``` |
| 444 | - 提示:在VSCode中可以复制所有的 devDependencies 到待升级项目的 devDependencies 中,重复的key会被划线,删掉老的即完成依赖补充和升级 | 446 | - 提示:在VSCode中可以复制所有的 devDependencies 到待升级项目的 devDependencies 中,重复的key会被划线,删掉老的即完成依赖补充和升级 |
| 445 | 2. 升级/添加RNOH前端依赖后,运行`npm i`安装依赖。若遇依赖冲突错误,可根据错误信息调整`package.json`中依赖库的版本来解决 | 447 | 2. 升级/添加RNOH前端依赖后,运行`npm i`安装依赖。若遇依赖冲突错误,可根据错误信息调整`package.json`中依赖库的版本来解决 |
| 446 | - - 升级 dependencies: "react-native-harmony" 或 "@xxx/react-native-harmony" 至 `0.86.3` | 448 | + - 升级 dependencies: "react-native-harmony" 或 "@xxx/react-native-harmony" 至 `0.86.3` |
| 447 | - >注意:保持原来的包名。如果原来 react-native-harmony 前面没有@组织前缀那么升级时也不要添加,如果原来有就保持之前的 "@xxx/react-native-harmony" | 449 | + > 注意:保持原来的包名。如果原来 react-native-harmony 前面没有@组织前缀那么升级时也不要添加,如果原来有就保持之前的 "@xxx/react-native-harmony" |
| 448 | - - 升级 devDependencies: "@react-native-oh/react-native-harmony-cli" 至 `0.86.3` | 450 | + - 升级 devDependencies: "@react-native-oh/react-native-harmony-cli" 至 `0.86.3` |
| 449 | - - 具体版本号请参考 [RNOH版本规划](../06-社区/roadmap.md) | 451 | + - 具体版本号请参考 [RNOH版本规划](../06-社区/roadmap.md) |
| 450 | 3. 检查并更新配置文件 | 452 | 3. 检查并更新配置文件 |
| 451 | 1. babel.config.js | 453 | 1. babel.config.js |
| 452 | - 确认`module.exports`中的`presets`字段使用 'module:@react-native/babel-preset' | 454 | - 确认`module.exports`中的`presets`字段使用 'module:@react-native/babel-preset' |
| @@ -488,3 +490,77 @@ yarn add @react-native-oh/react-native-harmony@x.x.x @react-native-oh/react-nati | |||
| 488 | - [AwesomeProject 模版项目从 0.84.1 到 0.86.3 的修改](https://react-native-community.github.io/upgrade-helper/?from=0.84.1&to=0.86.3) | 490 | - [AwesomeProject 模版项目从 0.84.1 到 0.86.3 的修改](https://react-native-community.github.io/upgrade-helper/?from=0.84.1&to=0.86.3) |
| 489 | - [React Native 0.86 发布说明(无面向用户破坏性变更)](https://reactnative.dev/blog/2026/06/11/react-native-0.86) | 491 | - [React Native 0.86 发布说明(无面向用户破坏性变更)](https://reactnative.dev/blog/2026/06/11/react-native-0.86) |
| 490 | - [上游社区 ChangeLog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md) | 492 | - [上游社区 ChangeLog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md) |
| 493 | + | ||
| 494 | +## 从 0.86.x 升级到 0.88.x | ||
| 495 | + | ||
| 496 | +本节描述如何将 RN 工程从 **0.86.x** 升级到 **0.88.x**。 | ||
| 497 | + | ||
| 498 | +> 说明:本节描述将 RN / RNOH 工程从 **0.86.x** 升级到 **0.88.x** 的依赖与工程步骤。升级后请按上游 0.88 发布说明与 Upgrade Helper 核对应用侧变更;Node.js 建议 **>= 22.11.0**。 | ||
| 499 | + | ||
| 500 | +1. 升级 RN 项目依赖版本 | ||
| 501 | + - 以下为已知必须升级的依赖 | ||
| 502 | + ```json | ||
| 503 | + { | ||
| 504 | + ... | ||
| 505 | + "dependencies": { | ||
| 506 | + "react": "19.3.0", | ||
| 507 | + "react-native": "0.88.1" | ||
| 508 | + }, | ||
| 509 | + "devDependencies": { | ||
| 510 | + "@react-native-community/cli": "20.2.0", | ||
| 511 | + "@react-native/babel-preset": "0.88.1" | ||
| 512 | + } | ||
| 513 | + } | ||
| 514 | + ``` | ||
| 515 | + - 上述所有依赖如果当前 0.86 项目中没有需要补充,版本都请和列出的保持一致 | ||
| 516 | + - 此外上游社区还升级了一些开发依赖,可以自行选择是否跟随社区升级 | ||
| 517 | + ```json | ||
| 518 | + { | ||
| 519 | + ... | ||
| 520 | + "devDependencies": { | ||
| 521 | + "@babel/core": "^7.25.2", | ||
| 522 | + "@babel/preset-env": "^7.25.3", | ||
| 523 | + "@babel/runtime": "^7.25.0", | ||
| 524 | + "@react-native-community/cli": "20.2.0", | ||
| 525 | + "@react-native-community/cli-platform-android": "20.2.0", | ||
| 526 | + "@react-native-community/cli-platform-ios": "20.2.0", | ||
| 527 | + "@react-native/babel-preset": "0.88.1", | ||
| 528 | + "@react-native/eslint-config": "0.88.1", | ||
| 529 | + "@react-native/metro-config": "0.88.1", | ||
| 530 | + "@react-native/typescript-config": "0.88.1", | ||
| 531 | + "@types/jest": "^29.5.13", | ||
| 532 | + "@types/react": "^19.2.0", | ||
| 533 | + "@types/react-test-renderer": "^19.1.0", | ||
| 534 | + "eslint": "^8.19.0", | ||
| 535 | + "jest": "^29.6.3", | ||
| 536 | + "prettier": "2.8.8", | ||
| 537 | + "react-test-renderer": "19.3.0", | ||
| 538 | + "typescript": "^5.8.3" | ||
| 539 | + } | ||
| 540 | + } | ||
| 541 | + ``` | ||
| 542 | + - 提示:在 VSCode 中可以复制所有的 `devDependencies` 到待升级项目的 `devDependencies` 中,重复的 key 会被划线,删掉老的即完成依赖补充和升级 | ||
| 543 | +2. 升级/添加 RNOH 前端依赖后,运行 `npm i` 安装依赖。若遇依赖冲突错误,可根据错误信息调整 `package.json` 中依赖库的版本来解决 | ||
| 544 | + - 升级 dependencies: `"react-native-harmony"` 或 `"@xxx/react-native-harmony"` 至 `0.88.1` | ||
| 545 | + > 注意:保持原来的包名。如果原来 `react-native-harmony` 前面没有 @ 组织前缀那么升级时也不要添加,如果原来有就保持之前的 `"@xxx/react-native-harmony"` | ||
| 546 | + - 升级 devDependencies: `"@react-native-oh/react-native-harmony-cli"` 至 `0.88.1` | ||
| 547 | + - 具体版本号请参考 [RNOH版本规划](../06-社区/roadmap.md) | ||
| 548 | +3. 检查并更新配置文件 | ||
| 549 | + 1. `babel.config.js` | ||
| 550 | + - 确认 `module.exports` 中的 `presets` 字段使用 `'module:@react-native/babel-preset'` | ||
| 551 | + ```jsx | ||
| 552 | + module.exports = { | ||
| 553 | + presets: ["module:@react-native/babel-preset"], | ||
| 554 | + }; | ||
| 555 | + ``` | ||
| 556 | +4. 执行 `npm run dev`(或 `npx react-native bundle-harmony --dev`)重新生成 `harmony/entry/src/main/resources/rawfile/bundle.harmony.js` 及 `assets` 目录。生成后重新同步并构建鸿蒙工程;如遇依赖冲突错误,可修改 `package.json`、`metro.config.js`、`babel.config.js` 等配置文件,根据错误提示进行调整即可 | ||
| 557 | +5. 修改鸿蒙工程中所有 `oh-package.json5` 中配置的 `@rnoh/react-native-openharmony` 依赖版本(例如 `0.88.1`),具体版本号请参考 [RNOH版本规划](../06-社区/roadmap.md) | ||
| 558 | +6. 在鸿蒙工程目录下运行 `ohpm i` 或在 DevEco Studio 中点击 `File->Sync and Refresh Project` 安装依赖 | ||
| 559 | +7. 打应用 hap 包,安装进行测试 | ||
| 560 | + | ||
| 561 | +参考资料: | ||
| 562 | + | ||
| 563 | +- [AwesomeProject 模版项目从 0.86.3 到 0.88.1 的修改](https://react-native-community.github.io/upgrade-helper/?from=0.86.3&to=0.88.1) | ||
| 564 | +- [React Native 0.88 发布说明](https://reactnative.dev/blog/2026/10/19/react-native-0.88) | ||
| 565 | +- [Strict TypeScript API](https://reactnative.dev/docs/strict-typescript-api) | ||
| 566 | +- [上游社区 ChangeLog](https://github.com/facebook/react-native/blob/main/CHANGELOG.md) | ||
| @@ -2,6 +2,10 @@ | |||
| 2 | 2 | ||
| 3 | > 本文件为 Release Notes 索引,各版本分支按其发布情况自行维护。**如何选择与安装稳定版本请见 [稳定版本识别与安装](./稳定版本识别与安装.md)。** | 3 | > 本文件为 Release Notes 索引,各版本分支按其发布情况自行维护。**如何选择与安装稳定版本请见 [稳定版本识别与安装](./稳定版本识别与安装.md)。** |
| 4 | 4 | ||
| 5 | +## React Native for OpenHarmony 0.88 Release | ||
| 6 | + | ||
| 7 | +- [RNOH v0.88.1](./release-notes/react-native-harmony-v0.88.1.md) | ||
| 8 | + | ||
| 5 | ## React Native for OpenHarmony 0.86 Release | 9 | ## React Native for OpenHarmony 0.86 Release |
| 6 | 10 | ||
| 7 | - [RNOH v0.86.2(2026-10-30)](./release-notes/react-native-harmony-v0.86.2.md) | 11 | - [RNOH v0.86.2(2026-10-30)](./release-notes/react-native-harmony-v0.86.2.md) |
| @@ -373,7 +373,7 @@ waitForSyncTask(task); | |||
| 373 | 历史案例: | 373 | 历史案例: |
| 374 | 374 | ||
| 375 | - [reportMount 触发 ShadowTreeRegistry 锁重入](../稳定性历史修复/0.82稳定性修复汇总/02-应用冻屏.md#ab0d11db7) | 375 | - [reportMount 触发 ShadowTreeRegistry 锁重入](../稳定性历史修复/0.82稳定性修复汇总/02-应用冻屏.md#ab0d11db7) |
| 376 | -- [getTurboModule 持锁创建 TM 导致死锁并引发卡死](../稳定性历史修复/0.77稳定性修复汇总/02-应用冻屏.md#a26036ba2) | 376 | +- [getTurboModule 持锁创建 TM 导致死锁并引发卡死](../稳定性历史修复/0.77稳定性修复汇总/02-应用冻屏.md#7420d467f) |
| 377 | 377 | ||
| 378 | ### 3.3 每类操作必须在规定线程上执行 | 378 | ### 3.3 每类操作必须在规定线程上执行 |
| 379 | 379 | ||
| @@ -64,6 +64,28 @@ timeline | |||
| 64 | 64 | ||
| 65 | ### 版本特征 | 65 | ### 版本特征 |
| 66 | 66 | ||
| 67 | +> 0.88.x | ||
| 68 | + | ||
| 69 | +- _[Web-based event dispatching](https://reactnative.dev/blog/2026/10/19/react-native-0.88#web-based-event-dispatching)_ | ||
| 70 | + 默认通过 W3C `EventTarget` 路径分发事件(capture/bubble),与 Web 事件模型对齐;对外事件 props 行为保持兼容,无面向用户的破坏性变更。 | ||
| 71 | +- _[Variable fonts with fontVariationSettings](https://reactnative.dev/blog/2026/10/19/react-native-0.88#variable-fonts-with-fontvariationsettings)_ | ||
| 72 | + `Text` / `TextInput` 支持 `fontVariationSettings`(对象或 CSS 字符串形式),用于可变字体轴控制。 | ||
| 73 | +- _[SceneDelegate lifecycle support on iOS](https://reactnative.dev/blog/2026/10/19/react-native-0.88#ios-scenedelegate-support)_ | ||
| 74 | + 增加 iOS `SceneDelegate` 生命周期支持(单 Scene),以适配新的 UIScene 要求。 | ||
| 75 | +- _[ArrayBuffer for Java TurboModules](https://reactnative.dev/blog/2026/10/19/react-native-0.88#arraybuffer-for-java-turbomodules)_ | ||
| 76 | + Java TurboModule 可直接接收/返回 JS `ArrayBuffer`,减少二进制数据的编解码开销。 | ||
| 77 | +- _[Experimental Swift Package Manager support](https://reactnative.dev/blog/2026/10/19/react-native-0.88#experimental-swift-package-manager-support)_ | ||
| 78 | + 继续完善实验性 SwiftPM 支持;依赖基线升级至 React 19.3.0、Metro 0.87。 | ||
| 79 | + | ||
| 80 | +> 0.86.x | ||
| 81 | + | ||
| 82 | +- _[Edge-to-Edge on Android](https://reactnative.dev/blog/2026/06/11/react-native-0.86#edge-to-edge-on-android)_ | ||
| 83 | + 完善 Android 15+ 边到边显示适配(`measureInWindow`、`KeyboardAvoidingView`、`Dimensions`、`StatusBar` 等)。 | ||
| 84 | +- _[React Native DevTools Improvements](https://reactnative.dev/blog/2026/06/11/react-native-0.86#react-native-devtools-improvements)_ | ||
| 85 | + DevTools 支持通过 `Emulation.setEmulatedMedia` 模拟浅色/深色模式。 | ||
| 86 | +- _[No user-facing breaking changes](https://reactnative.dev/blog/2026/06/11/react-native-0.86#breaking-changes)_ | ||
| 87 | + 继 0.83 之后,再次实现无面向用户破坏性变更的升级体验。 | ||
| 88 | + | ||
| 67 | > 0.84.x | 89 | > 0.84.x |
| 68 | 90 | ||
| 69 | - _[Hermes V1 as Default](https://reactnative.dev/blog/2026/02/11/react-native-0.84#hermes-v1-as-default)_ | 91 | - _[Hermes V1 as Default](https://reactnative.dev/blog/2026/02/11/react-native-0.84#hermes-v1-as-default)_ |
| @@ -10,22 +10,22 @@ | |||
| 10 | 10 | ||
| 11 | ### 目录与开发者旅程对应 | 11 | ### 目录与开发者旅程对应 |
| 12 | 12 | ||
| 13 | -| 目录 | 旅程阶段 | 核心内容 | 版本相关 | | 13 | +| 目录 | 旅程阶段 | 核心内容 | 版本相关 | |
| 14 | -|------|----------|----------|----------| | 14 | +| --------- | -------- | ------------------------------ | -------- | |
| 15 | -| `01-设计` | 设计 | 接口规格、架构规划、通信机制 | ✅ 部分 | | 15 | +| `01-设计` | 设计 | 接口规格、架构规划、通信机制 | ✅ 部分 | |
| 16 | -| `02-开发` | 开发 | 环境搭建、功能开发、组件定制 | ✅ 部分 | | 16 | +| `02-开发` | 开发 | 环境搭建、功能开发、组件定制 | ✅ 部分 | |
| 17 | -| `03-调测` | 调测 | 调试方法、问题定位、FAQ | ❌ | | 17 | +| `03-调测` | 调测 | 调试方法、问题定位、FAQ | ❌ | |
| 18 | -| `04-调优` | 调优 | 性能优化、实践案例 | ❌ | | 18 | +| `04-调优` | 调优 | 性能优化、实践案例 | ❌ | |
| 19 | -| `05-运维` | 运维 | 版本管理、稳定性管理、构建打包 | ✅ | | 19 | +| `05-运维` | 运维 | 版本管理、稳定性管理、构建打包 | ✅ | |
| 20 | -| `06-社区` | 社区治理 | 社区规范、共建指南、路线图 | ❌ | | 20 | +| `06-社区` | 社区治理 | 社区规范、共建指南、路线图 | ❌ | |
| 21 | 21 | ||
| 22 | ### 版本相关文档标识 | 22 | ### 版本相关文档标识 |
| 23 | 23 | ||
| 24 | 以下文档需随版本发布同步更新: | 24 | 以下文档需随版本发布同步更新: |
| 25 | 25 | ||
| 26 | -| 目录 | 版本相关文件 | | 26 | +| 目录 | 版本相关文件 | |
| 27 | -|------|-------------| | 27 | +| --------- | ------------------------------------------------------------------------------------- | |
| 28 | -| `02-开发` | `环境搭建.md`、`SDK版本配置指导.md`、`Autolinking.md` | | 28 | +| `02-开发` | `环境搭建.md`、`SDK版本配置指导.md`、`Autolinking.md` | |
| 29 | | `05-运维` | `版本说明.md`、`版本升级指导.md`、`release-notes/`、`RN-JS打包.md`、`稳定性历史修复/` | | 29 | | `05-运维` | `版本说明.md`、`版本升级指导.md`、`release-notes/`、`RN-JS打包.md`、`稳定性历史修复/` | |
| 30 | 30 | ||
| 31 | --- | 31 | --- |
| @@ -34,13 +34,14 @@ | |||
| 34 | 34 | ||
| 35 | ### 文件命名规范 | 35 | ### 文件命名规范 |
| 36 | 36 | ||
| 37 | -| 规范项 | 中文 | 英文 | | 37 | +| 规范项 | 中文 | 英文 | |
| 38 | -|--------|------|------| | 38 | +| ------ | ---------------------------- | -------------------- | |
| 39 | | 文件名 | 中文命名,无空格,使用连字符 | 小写英文,使用连字符 | | 39 | | 文件名 | 中文命名,无空格,使用连字符 | 小写英文,使用连字符 | |
| 40 | -| 编码 | UTF-8 无 BOM | UTF-8 无 BOM | | 40 | +| 编码 | UTF-8 无 BOM | UTF-8 无 BOM | |
| 41 | -| 格式 | Markdown (.md) | Markdown (.md) | | 41 | +| 格式 | Markdown (.md) | Markdown (.md) | |
| 42 | 42 | ||
| 43 | **示例:** | 43 | **示例:** |
| 44 | + | ||
| 44 | - 中文:`版本升级指导.md`、`调试调测.md` | 45 | - 中文:`版本升级指导.md`、`调试调测.md` |
| 45 | - 英文:`version-upgrade-guide.md`、`debugging.md` | 46 | - 英文:`version-upgrade-guide.md`、`debugging.md` |
| 46 | 47 | ||
| @@ -51,7 +52,7 @@ | |||
| 51 | ```markdown | 52 | ```markdown |
| 52 | # 文档标题 | 53 | # 文档标题 |
| 53 | 54 | ||
| 54 | -> 适用版本:v0.72 / v0.77 / v0.82 / v0.84 / v0.86(版本相关文档需标注) | 55 | +> 适用版本:v0.72 / v0.77 / v0.82 / v0.84 / v0.86 / v0.88(版本相关文档需标注) |
| 55 | > 开发者旅程:设计 / 开发 / 调测 / 调优 / 测试 / 运维 | 56 | > 开发者旅程:设计 / 开发 / 调测 / 调优 / 测试 / 运维 |
| 56 | > 最后更新:YYYY-MM-DD | 57 | > 最后更新:YYYY-MM-DD |
| 57 | > 贡献者:@username | 58 | > 贡献者:@username |
| @@ -63,13 +64,13 @@ | |||
| 63 | 64 | ||
| 64 | ### 内容编写要求 | 65 | ### 内容编写要求 |
| 65 | 66 | ||
| 66 | -| 要求 | 说明 | | 67 | +| 要求 | 说明 | |
| 67 | -|------|------| | 68 | +| ------------ | ------------------------------------------ | |
| 68 | | **标题层级** | 最多 4 级(# → ## → ### → ####),禁止跳级 | | 69 | | **标题层级** | 最多 4 级(# → ## → ### → ####),禁止跳级 | |
| 69 | -| **段落长度** | 每段不超过 5 行,便于阅读 | | 70 | +| **段落长度** | 每段不超过 5 行,便于阅读 | |
| 70 | -| **代码示例** | 必须标注语言,提供完整可运行示例 | | 71 | +| **代码示例** | 必须标注语言,提供完整可运行示例 | |
| 71 | -| **图片规范** | 存放于 `figures/` 目录,使用相对路径引用 | | 72 | +| **图片规范** | 存放于 `figures/` 目录,使用相对路径引用 | |
| 72 | -| **链接规范** | 优先使用相对路径,外部链接需标注来源 | | 73 | +| **链接规范** | 优先使用相对路径,外部链接需标注来源 | |
| 73 | 74 | ||
| 74 | --- | 75 | --- |
| 75 | 76 | ||
| @@ -77,16 +78,16 @@ | |||
| 77 | 78 | ||
| 78 | ### 双语文件对应规则 | 79 | ### 双语文件对应规则 |
| 79 | 80 | ||
| 80 | -| 中文文件 | 英文文件 | 位置关系 | | 81 | +| 中文文件 | 英文文件 | 位置关系 | |
| 81 | -|----------|----------|----------| | 82 | +| -------------------------------- | ----------------------------------- | ---------------- | |
| 82 | | `docs/zh-cn/01-设计/架构介绍.md` | `docs/en/01-design/architecture.md` | 对应目录层级一致 | | 83 | | `docs/zh-cn/01-设计/架构介绍.md` | `docs/en/01-design/architecture.md` | 对应目录层级一致 | |
| 83 | 84 | ||
| 84 | ### 双语同步要求 | 85 | ### 双语同步要求 |
| 85 | 86 | ||
| 86 | -| 要求 | 说明 | | 87 | +| 要求 | 说明 | |
| 87 | -|------|------| | 88 | +| ------------ | -------------------------------------- | |
| 88 | -| **内容一致** | 核心技术内容必须完全同步,不得有差异 | | 89 | +| **内容一致** | 核心技术内容必须完全同步,不得有差异 | |
| 89 | -| **同步更新** | 中文更新后,英文版本需在 7 天内同步 | | 90 | +| **同步更新** | 中文更新后,英文版本需在 7 天内同步 | |
| 90 | | **标注差异** | 若中文有本土化补充内容,需在英文版标注 | | 91 | | **标注差异** | 若中文有本土化补充内容,需在英文版标注 | |
| 91 | 92 | ||
| 92 | ### 新增文档流程 | 93 | ### 新增文档流程 |
| @@ -104,28 +105,28 @@ | |||
| 104 | 105 | ||
| 105 | 新增文档时,按以下标准判定所属目录: | 106 | 新增文档时,按以下标准判定所属目录: |
| 106 | 107 | ||
| 107 | -| 旅程阶段 | 判定标准 | 归属目录 | | 108 | +| 旅程阶段 | 判定标准 | 归属目录 | |
| 108 | -|----------|----------|----------| | 109 | +| -------- | -------------------------------------------- | --------- | |
| 109 | -| **设计** | 接口规格、架构原理、通信机制、技术规划 | `01-设计` | | 110 | +| **设计** | 接口规格、架构原理、通信机制、技术规划 | `01-设计` | |
| 110 | -| **开发** | 环境搭建、功能开发、组件定制、开发指南 | `02-开发` | | 111 | +| **开发** | 环境搭建、功能开发、组件定制、开发指南 | `02-开发` | |
| 111 | -| **调测** | 调试工具、问题定位方法、FAQ、排错指南 | `03-调测` | | 112 | +| **调测** | 调试工具、问题定位方法、FAQ、排错指南 | `03-调测` | |
| 112 | -| **调优** | 性能优化方法、优化实践案例、性能分析 | `04-调优` | | 113 | +| **调优** | 性能优化方法、优化实践案例、性能分析 | `04-调优` | |
| 113 | | **运维** | 版本管理、稳定性管理、构建打包、历史修复归档 | `05-运维` | | 114 | | **运维** | 版本管理、稳定性管理、构建打包、历史修复归档 | `05-运维` | |
| 114 | -| **社区** | 社区规范、共建指南、路线图、贡献流程 | `06-社区` | | 115 | +| **社区** | 社区规范、共建指南、路线图、贡献流程 | `06-社区` | |
| 115 | 116 | ||
| 116 | ### 版本相关性判定 | 117 | ### 版本相关性判定 |
| 117 | 118 | ||
| 118 | 在确定旅程目录后,需进一步判定是否版本相关: | 119 | 在确定旅程目录后,需进一步判定是否版本相关: |
| 119 | 120 | ||
| 120 | -| 标准 | 版本相关 | 示例 | | 121 | +| 标准 | 版本相关 | 示例 | |
| 121 | -|------|----------|------| | 122 | +| ------------ | -------- | ----------------------------- | |
| 122 | -| 含版本号 | ✅ | `版本升级指导.md` | | 123 | +| 含版本号 | ✅ | `版本升级指导.md` | |
| 123 | -| SDK版本依赖 | ✅ | `SDK版本配置指导.md` | | 124 | +| SDK版本依赖 | ✅ | `SDK版本配置指导.md` | |
| 124 | -| API版本变更 | ✅ | `RN升级需要开发者适配整理.md` | | 125 | +| API版本变更 | ✅ | `RN升级需要开发者适配整理.md` | |
| 125 | -| 发布记录 | ✅ | `release-notes/` | | 126 | +| 发布记录 | ✅ | `release-notes/` | |
| 126 | -| 历史修复归档 | ✅ | `0.82稳定性修复汇总/` | | 127 | +| 历史修复归档 | ✅ | `0.82稳定性修复汇总/` | |
| 127 | -| 原理方法 | ❌ | `架构介绍.md`、`调试调测.md` | | 128 | +| 原理方法 | ❌ | `架构介绍.md`、`调试调测.md` | |
| 128 | -| 规范标准 | ❌ | `社区issue管理规范.md` | | 129 | +| 规范标准 | ❌ | `社区issue管理规范.md` | |
| 129 | 130 | ||
| 130 | --- | 131 | --- |
| 131 | 132 | ||
| @@ -133,21 +134,22 @@ | |||
| 133 | 134 | ||
| 134 | ### 提交前检查清单 | 135 | ### 提交前检查清单 |
| 135 | 136 | ||
| 136 | -| 检查项 | 说明 | | 137 | +| 检查项 | 说明 | |
| 137 | -|--------|------| | 138 | +| -------- | ---------------------------- | |
| 138 | | 旅程目录 | 文档是否存放于正确的旅程目录 | | 139 | | 旅程目录 | 文档是否存放于正确的旅程目录 | |
| 139 | | 版本标识 | 版本相关文档是否标注适用版本 | | 140 | | 版本标识 | 版本相关文档是否标注适用版本 | |
| 140 | -| 文件命名 | 是否符合命名规范 | | 141 | +| 文件命名 | 是否符合命名规范 | |
| 141 | -| 双语同步 | 是否同步创建/更新英文版本 | | 142 | +| 双语同步 | 是否同步创建/更新英文版本 | |
| 142 | -| 导航更新 | 是否更新 README.md 导航 | | 143 | +| 导航更新 | 是否更新 README.md 导航 | |
| 143 | -| 链接有效 | 内部链接是否可正常跳转 | | 144 | +| 链接有效 | 内部链接是否可正常跳转 | |
| 144 | -| 图片路径 | 图片引用路径是否正确 | | 145 | +| 图片路径 | 图片引用路径是否正确 | |
| 145 | 146 | ||
| 146 | ### PR 提交规范 | 147 | ### PR 提交规范 |
| 147 | 148 | ||
| 148 | 1. **标题格式**:`docs: 新增/更新/修复 [旅程阶段] [文档名称]` | 149 | 1. **标题格式**:`docs: 新增/更新/修复 [旅程阶段] [文档名称]` |
| 149 | 150 | ||
| 150 | 示例: | 151 | 示例: |
| 152 | + | ||
| 151 | - `docs: 新增 开发 多屏适配指导文档` | 153 | - `docs: 新增 开发 多屏适配指导文档` |
| 152 | - `docs: 更新 运维 版本升级指导 v0.82 补充` | 154 | - `docs: 更新 运维 版本升级指导 v0.82 补充` |
| 153 | - `docs: 修复 调测 FAQ链接错误` | 155 | - `docs: 修复 调测 FAQ链接错误` |
| @@ -156,14 +158,14 @@ | |||
| 156 | 158 | ||
| 157 | ```markdown | 159 | ```markdown |
| 158 | ## 变更说明 | 160 | ## 变更说明 |
| 159 | - | 161 | + |
| 160 | - [新增/更新/修复] 文档:xxx | 162 | - [新增/更新/修复] 文档:xxx |
| 161 | - 开发者旅程:设计 / 开发 / 调测 / 调优 / 测试 / 运维 / 社区 | 163 | - 开发者旅程:设计 / 开发 / 调测 / 调优 / 测试 / 运维 / 社区 |
| 162 | - 版本相关:是 / 否 | 164 | - 版本相关:是 / 否 |
| 163 | - 双语同步:已同步英文版本 / 待同步 | 165 | - 双语同步:已同步英文版本 / 待同步 |
| 164 | - | 166 | + |
| 165 | ## 检查清单 | 167 | ## 检查清单 |
| 166 | - | 168 | + |
| 167 | - [x] 旅程目录正确 | 169 | - [x] 旅程目录正确 |
| 168 | - [x] 版本标识完整 | 170 | - [x] 版本标识完整 |
| 169 | - [x] 文件命名规范 | 171 | - [x] 文件命名规范 |
| @@ -180,14 +182,14 @@ | |||
| 180 | 182 | ||
| 181 | ### 审核维度 | 183 | ### 审核维度 |
| 182 | 184 | ||
| 183 | -| 维度 | 标准 | | 185 | +| 维度 | 标准 | |
| 184 | -|------|------| | 186 | +| ------------ | -------------------------------- | |
| 185 | -| **准确性** | 技术内容准确无误,代码示例可运行 | | 187 | +| **准确性** | 技术内容准确无误,代码示例可运行 | |
| 186 | -| **完整性** | 内容覆盖完整,无关键信息遗漏 | | 188 | +| **完整性** | 内容覆盖完整,无关键信息遗漏 | |
| 187 | -| **规范性** | 符合命名、格式、双语同步规范 | | 189 | +| **规范性** | 符合命名、格式、双语同步规范 | |
| 188 | -| **可读性** | 结构清晰,语言简洁,易于理解 | | 190 | +| **可读性** | 结构清晰,语言简洁,易于理解 | |
| 189 | -| **时效性** | 版本相关文档信息为最新版本 | | 191 | +| **时效性** | 版本相关文档信息为最新版本 | |
| 190 | -| **旅程匹配** | 文档内容与所属旅程目录匹配 | | 192 | +| **旅程匹配** | 文档内容与所属旅程目录匹配 | |
| 191 | 193 | ||
| 192 | ### 审核流程 | 194 | ### 审核流程 |
| 193 | 195 | ||
| @@ -202,6 +204,7 @@ | |||
| 202 | ### Q1:如何判断文档应该放在哪个目录? | 204 | ### Q1:如何判断文档应该放在哪个目录? |
| 203 | 205 | ||
| 204 | 按开发者旅程判定: | 206 | 按开发者旅程判定: |
| 207 | + | ||
| 205 | - 设计阶段产出 → `01-设计` | 208 | - 设计阶段产出 → `01-设计` |
| 206 | - 开发过程所需 → `02-开发` | 209 | - 开发过程所需 → `02-开发` |
| 207 | - 调试排错相关 → `03-调测` | 210 | - 调试排错相关 → `03-调测` |
| @@ -212,6 +215,7 @@ | |||
| 212 | ### Q2:英文版暂时无法同步怎么办? | 215 | ### Q2:英文版暂时无法同步怎么办? |
| 213 | 216 | ||
| 214 | 在 PR 中标注「待同步」,并在中文文档头部添加: | 217 | 在 PR 中标注「待同步」,并在中文文档头部添加: |
| 218 | + | ||
| 215 | ```markdown | 219 | ```markdown |
| 216 | > 英文版本待同步,欢迎社区贡献翻译 | 220 | > 英文版本待同步,欢迎社区贡献翻译 |
| 217 | ``` | 221 | ``` |
| @@ -219,6 +223,7 @@ | |||
| 219 | ### Q3:图片如何存放? | 223 | ### Q3:图片如何存放? |
| 220 | 224 | ||
| 221 | 存放于文档同级或上级的 `figures/` 目录: | 225 | 存放于文档同级或上级的 `figures/` 目录: |
| 226 | + | ||
| 222 | ```markdown | 227 | ```markdown |
| 223 |  | 228 |  |
| 224 | ``` | 229 | ``` |
| @@ -226,42 +231,43 @@ | |||
| 226 | ### Q4:如何更新 README 导航? | 231 | ### Q4:如何更新 README 导航? |
| 227 | 232 | ||
| 228 | 在对应语言目录的 `README.md` 中: | 233 | 在对应语言目录的 `README.md` 中: |
| 234 | + | ||
| 229 | 1. 在「开发者旅程导航」表格添加新条目 | 235 | 1. 在「开发者旅程导航」表格添加新条目 |
| 230 | 2. 在「目录结构」树形图添加文件位置 | 236 | 2. 在「目录结构」树形图添加文件位置 |
| 231 | 237 | ||
| 232 | ### Q5:版本相关文档更新时机? | 238 | ### Q5:版本相关文档更新时机? |
| 233 | 239 | ||
| 234 | -| 文档类型 | 更新时机 | | 240 | +| 文档类型 | 更新时机 | |
| 235 | -|----------|----------| | 241 | +| -------- | -------------------- | |
| 236 | -| 版本说明 | 版本发布当天 | | 242 | +| 版本说明 | 版本发布当天 | |
| 237 | -| 升级指导 | 版本发布当天 | | 243 | +| 升级指导 | 版本发布当天 | |
| 238 | -| SDK配置 | SDK版本变更时 | | 244 | +| SDK配置 | SDK版本变更时 | |
| 239 | | 历史修复 | 版本发布后一周内归档 | | 245 | | 历史修复 | 版本发布后一周内归档 | |
| 240 | 246 | ||
| 241 | --- | 247 | --- |
| 242 | 248 | ||
| 243 | ## 八、贡献者激励 | 249 | ## 八、贡献者激励 |
| 244 | 250 | ||
| 245 | -| 贡献类型 | 认证方式 | | 251 | +| 贡献类型 | 认证方式 | |
| 246 | -|----------|----------| | 252 | +| ---------------- | ------------------------- | |
| 247 | -| 新增核心文档 | 文档署名 + 社区贡献者认证 | | 253 | +| 新增核心文档 | 文档署名 + 社区贡献者认证 | |
| 248 | -| 双语同步贡献 | 翻译贡献者认证 | | 254 | +| 双语同步贡献 | 翻译贡献者认证 | |
| 249 | -| 文档持续维护 | 文档维护者认证 | | 255 | +| 文档持续维护 | 文档维护者认证 | |
| 250 | -| 版本文档及时更新 | 版本维护者认证 | | 256 | +| 版本文档及时更新 | 版本维护者认证 | |
| 251 | 257 | ||
| 252 | --- | 258 | --- |
| 253 | 259 | ||
| 254 | ## 附录:目录结构速查表 | 260 | ## 附录:目录结构速查表 |
| 255 | 261 | ||
| 256 | -| 目录 | 旅程阶段 | 版本相关 | 核心内容 | | 262 | +| 目录 | 旅程阶段 | 版本相关 | 核心内容 | |
| 257 | -|------|----------|----------|----------| | 263 | +| ------- | -------- | -------- | ---------------------------- | |
| 258 | -| 01-设计 | 设计 | ❌ | 架构、原理、接口规格 | | 264 | +| 01-设计 | 设计 | ❌ | 架构、原理、接口规格 | |
| 259 | -| 02-开发 | 开发 | ✅ 部分 | 环境、功能、组件、场景 | | 265 | +| 02-开发 | 开发 | ✅ 部分 | 环境、功能、组件、场景 | |
| 260 | -| 03-调测 | 调测 | ❌ | 调试、定位、FAQ | | 266 | +| 03-调测 | 调测 | ❌ | 调试、定位、FAQ | |
| 261 | -| 04-调优 | 调优 | ❌ | 性能、实践案例 | | 267 | +| 04-调优 | 调优 | ❌ | 性能、实践案例 | |
| 262 | -| 05-运维 | 运维 | ✅ | 版本、构建、稳定性、修复归档 | | 268 | +| 05-运维 | 运维 | ✅ | 版本、构建、稳定性、修复归档 | |
| 263 | -| 06-社区 | 社区治理 | ❌ | 规范、路线图 | | 269 | +| 06-社区 | 社区治理 | ❌ | 规范、路线图 | |
| 264 | 270 | ||
| 265 | --- | 271 | --- |
| 266 | 272 | ||
| 267 | -> 如有疑问,请在社区 Issue 中提出,或联系文档维护者。 | 273 | +> 如有疑问,请在社区 Issue 中提出,或联系文档维护者。 |
| @@ -20,7 +20,7 @@ | |||
| 20 | ### 1.1 背景 | 20 | ### 1.1 背景 |
| 21 | 21 | ||
| 22 | - **组织迁移**:RN Sig 成立,RNOH仓库迁移至独立组织空间 `CPF-RN` | 22 | - **组织迁移**:RN Sig 成立,RNOH仓库迁移至独立组织空间 `CPF-RN` |
| 23 | -- **多版本并行**:维护版本(0.72、0.77、0.82)与探索版本(0.84)共存 | 23 | +- **多版本并行**:维护版本(0.72、0.77、0.82、0.84)与当前适配分支(`0.88-preview`)并存,默认分支 `main` 为版本演进基线 |
| 24 | - **治理需求**:需建立清晰、可落地的分支治理体系 | 24 | - **治理需求**:需建立清晰、可落地的分支治理体系 |
| 25 | 25 | ||
| 26 | ### 1.2 目标 | 26 | ### 1.2 目标 |
| @@ -39,7 +39,9 @@ | |||
| 39 | **主干开发 + 多版本维护模式** | 39 | **主干开发 + 多版本维护模式** |
| 40 | 40 | ||
| 41 | ``` | 41 | ``` |
| 42 | -main (探索) | 42 | +0.88-preview (0.88 适配进行中) |
| 43 | + ↓ (就绪后回合) | ||
| 44 | +main (版本演进) | ||
| 43 | ↓ | 45 | ↓ |
| 44 | 0.82-main ← 0.82-feature/* ← 开发者 | 46 | 0.82-main ← 0.82-feature/* ← 开发者 |
| 45 | ↓ cherry-pick | 47 | ↓ cherry-pick |
| @@ -48,19 +50,19 @@ main (探索) | |||
| 48 | 50 | ||
| 49 | ### 2.2 分支结构 | 51 | ### 2.2 分支结构 |
| 50 | 52 | ||
| 51 | -| 分支类型 | 命名规范 | 用途 | | 53 | +| 分支类型 | 命名规范 | 用途 | |
| 52 | -|---------|---------|------| | 54 | +| ---------------- | --------------------------- | ------------------------------------------------------- | |
| 53 | -| 主干 | `main` | 下一代探索开发(0.84) | | 55 | +| 主干 | `main` | 版本演进基线(生产请用已发布的 `0.XX-stable` dist-tag) | |
| 54 | -| 版本演进主干 | `${version}-main` | 对应版本的日常开发、功能迭代 | | 56 | +| 版本演进主干 | `${version}-main` | 对应版本的日常开发、功能迭代 | |
| 55 | -| 商业发布分支 | `${version}-stable` | 商业版本交付,仅关键修复 | | 57 | +| 商业发布分支 | `${version}-stable` | 商业版本交付,仅关键修复 | |
| 56 | -| 特性分支 | `${version}-feature/<name>` | 大型特性隔离开发 | | 58 | +| 特性分支 | `${version}-feature/<name>` | 大型特性隔离开发 | |
| 57 | -| 修复分支(可选) | `${version}-hotfix/<issue>` | 紧急修复,合并至演进主干及发布分支 | | 59 | +| 修复分支(可选) | `${version}-hotfix/<issue>` | 紧急修复,合并至演进主干及发布分支 | |
| 58 | 60 | ||
| 59 | ### 2.3 核心原则 | 61 | ### 2.3 核心原则 |
| 60 | 62 | ||
| 61 | 1. **单向流动**:特性分支 → 演进主干 →(cherry-pick)发布分支 | 63 | 1. **单向流动**:特性分支 → 演进主干 →(cherry-pick)发布分支 |
| 62 | 2. **稳定产出**:版本演进主干稳定后,产出发布分支 | 64 | 2. **稳定产出**:版本演进主干稳定后,产出发布分支 |
| 63 | -3. **探索隔离**:main 分支代码不直接合入正式版本 | 65 | +3. **基线隔离**:`main` 为最新演进基线,不保证生产稳定性;生产接入请使用对应版本线的 `-stable` / npm dist-tag |
| 64 | 4. **修复同步**:发布分支独占修复必须同步回演进主干 | 66 | 4. **修复同步**:发布分支独占修复必须同步回演进主干 |
| 65 | 67 | ||
| 66 | --- | 68 | --- |
| @@ -69,8 +71,8 @@ main (探索) | |||
| 69 | 71 | ||
| 70 | ### 3.1 主干分支(main) | 72 | ### 3.1 主干分支(main) |
| 71 | 73 | ||
| 72 | -- **用途**:下一代版本探索开发(0.84) | 74 | +- **用途**:当前版本线演进基线(现为 0.88 升级与文档同步) |
| 73 | -- **特性**:不保证稳定性,允许实验性改动 | 75 | +- **特性**:持续演进,不保证生产稳定性;允许合入新版本适配改动 |
| 74 | - **权限**:Maintainer 级别可合并 | 76 | - **权限**:Maintainer 级别可合并 |
| 75 | - **保护规则**: | 77 | - **保护规则**: |
| 76 | - 必须通过 CI 检查 | 78 | - 必须通过 CI 检查 |
| @@ -128,13 +130,13 @@ main (探索) | |||
| 128 | 130 | ||
| 129 | ### 4.1 分支对应关系 | 131 | ### 4.1 分支对应关系 |
| 130 | 132 | ||
| 131 | -| 版本 | 演进主干 | 商业发布分支 | | 133 | +| 版本 | 演进主干 | 商业发布分支 | |
| 132 | -|-----|---------|-------------| | 134 | +| ---- | -------------- | ------------- | |
| 133 | -| 0.72 | `0.72-main` | `0.72-stable` | | 135 | +| 0.72 | `0.72-main` | `0.72-stable` | |
| 134 | -| 0.77 | `0.77-main` | `0.77-stable` | | 136 | +| 0.77 | `0.77-main` | `0.77-stable` | |
| 135 | -| 0.82 | `0.82-main` | `0.82-stable` | | 137 | +| 0.82 | `0.82-main` | `0.82-stable` | |
| 136 | -| 探索 | `main` | — | | 138 | +| 0.84 | `0.84-main` | `0.84-stable` | |
| 137 | - | 139 | +| 0.88 | `0.88-preview` | — | |
| 138 | 140 | ||
| 139 | ## 5. 分支操作规范 | 141 | ## 5. 分支操作规范 |
| 140 | 142 | ||
| @@ -199,17 +201,18 @@ main (探索) | |||
| 199 | - 优先使用 `cherry-pick` | 201 | - 优先使用 `cherry-pick` |
| 200 | - 禁止直接合并 | 202 | - 禁止直接合并 |
| 201 | - **操作流程**: | 203 | - **操作流程**: |
| 204 | + | ||
| 202 | ```bash | 205 | ```bash |
| 203 | # 获取修复 commit hash | 206 | # 获取修复 commit hash |
| 204 | git log 0.82-main --oneline | 207 | git log 0.82-main --oneline |
| 205 | - | 208 | + |
| 206 | # 切换到发布分支 | 209 | # 切换到发布分支 |
| 207 | git checkout 0.82-stable | 210 | git checkout 0.82-stable |
| 208 | git pull origin 0.82-stable | 211 | git pull origin 0.82-stable |
| 209 | - | 212 | + |
| 210 | # Cherry-pick 修复 | 213 | # Cherry-pick 修复 |
| 211 | git cherry-pick <commit-hash> | 214 | git cherry-pick <commit-hash> |
| 212 | - | 215 | + |
| 213 | # 推送 | 216 | # 推送 |
| 214 | git push origin 0.82-stable | 217 | git push origin 0.82-stable |
| 215 | ``` | 218 | ``` |
| @@ -239,12 +242,13 @@ main (探索) | |||
| 239 | 242 | ||
| 240 | ### 6.1 维护周期表 | 243 | ### 6.1 维护周期表 |
| 241 | 244 | ||
| 242 | -| 版本 | 演进主干维护期 | 发布分支维护期 | 状态 | | 245 | +| 版本 | 演进主干维护期 | 发布分支维护期 | 状态 | |
| 243 | -|-----|--------------|--------------|------| | 246 | +| --------------------- | ---------------------------- | ------------------- | ------------------------------ | |
| 244 | -| 0.72 | 安全补丁 + 关键缺陷 | 安全补丁 + 关键缺陷 | 长期维护 | | 247 | +| 0.72 | 安全补丁 + 关键缺陷 | 安全补丁 + 关键缺陷 | 长期维护 | |
| 245 | -| 0.77 | 积极维护,新特性可合入 | 同步更新 | 主力版本 | | 248 | +| 0.77 | 积极维护,新特性可合入 | 同步更新 | 主力版本 | |
| 246 | -| 0.82 | 积极维护,新特性可合入 | 同步更新 | 主力版本 | | 249 | +| 0.82 | 积极维护,新特性可合入 | 同步更新 | 主力版本 | |
| 247 | -| main | 探索开发,不保证稳定性 | — | 探索中 | | 250 | +| 0.84 | 积极维护,新特性可合入 | 同步更新 | 发布中(npm 当前为 `0.84-rc`) | |
| 251 | +| 0.88 / `0.88-preview` | 在 `0.88-preview` 上适配推进 | — | 适配中 | | ||
| 248 | 252 | ||
| 249 | ### 6.2 版本演进规则 | 253 | ### 6.2 版本演进规则 |
| 250 | 254 | ||
| @@ -257,12 +261,12 @@ main (探索) | |||
| 257 | 261 | ||
| 258 | ### 6.3 维护职责 | 262 | ### 6.3 维护职责 |
| 259 | 263 | ||
| 260 | -| 角色 | 职责 | | 264 | +| 角色 | 职责 | |
| 261 | -|-----|------| | 265 | +| --------------- | -------------------------------- | |
| 262 | -| 版本负责人 | 版本规划、分支创建、维护周期管理 | | 266 | +| 版本负责人 | 版本规划、分支创建、维护周期管理 | |
| 263 | | Release Manager | 发布分支管理、标签创建、发布流程 | | 267 | | Release Manager | 发布分支管理、标签创建、发布流程 | |
| 264 | -| Maintainer | 代码审查、合并决策、质量把关 | | 268 | +| Maintainer | 代码审查、合并决策、质量把关 | |
| 265 | -| 开发者 | 特性开发、提交修复、遵循规范 | | 269 | +| 开发者 | 特性开发、提交修复、遵循规范 | |
| 266 | 270 | ||
| 267 | --- | 271 | --- |
| 268 | 272 | ||
| @@ -270,10 +274,10 @@ main (探索) | |||
| 270 | 274 | ||
| 271 | ### 7.1 分支保护规则 | 275 | ### 7.1 分支保护规则 |
| 272 | 276 | ||
| 273 | -| 分支类型 | 保护规则 | | 277 | +| 分支类型 | 保护规则 | |
| 274 | -|---------|---------| | 278 | +| ---------- | ------------------------------------------------------------ | |
| 275 | -| `main` | CI 必需 + 1 Maintainer 审批 + 禁止 Force Push | | 279 | +| `main` | CI 必需 + 1 Maintainer 审批 + 禁止 Force Push | |
| 276 | -| `*-main` | CI 必需 + 1 Maintainer 审批 + 禁止 Force Push | | 280 | +| `*-main` | CI 必需 + 1 Maintainer 审批 + 禁止 Force Push | |
| 277 | | `*-stable` | CI 必需 + 2 Maintainer 审批 + 禁止 Force Push + 禁止直接合并 | | 281 | | `*-stable` | CI 必需 + 2 Maintainer 审批 + 禁止 Force Push + 禁止直接合并 | |
| 278 | 282 | ||
| 279 | ### 7.2 CI 检查项 | 283 | ### 7.2 CI 检查项 |
| @@ -298,27 +302,31 @@ main (探索) | |||
| 298 | ### Q1:我应该在哪个分支提交代码? | 302 | ### Q1:我应该在哪个分支提交代码? |
| 299 | 303 | ||
| 300 | **A**: | 304 | **A**: |
| 305 | + | ||
| 301 | - 日常开发:fork对应仓库,在自己仓库完成开发及验证。完成后合回 `-main` | 306 | - 日常开发:fork对应仓库,在自己仓库完成开发及验证。完成后合回 `-main` |
| 302 | - 发布分支修复:先合 `-main`,验证通过后 cherry-pick 到 `-stable` | 307 | - 发布分支修复:先合 `-main`,验证通过后 cherry-pick 到 `-stable` |
| 303 | -- 新版本探索性开发:在 `main` 分支进行 | 308 | +- 0.88 适配与文档同步:在 `0.88-preview` 分支进行 |
| 304 | 309 | ||
| 305 | ### Q2:多个版本需要同一个修复怎么办? | 310 | ### Q2:多个版本需要同一个修复怎么办? |
| 306 | 311 | ||
| 307 | **A**: | 312 | **A**: |
| 308 | -1. 优先合入最新演进主干(如 `0.82-main`) | 313 | + |
| 314 | +1. 优先合入最新演进主干(0.88 工作当前为 `0.88-preview`,或目标版本的 `0.XX-main`) | ||
| 309 | 2. 根据影响范围 cherry-pick 到其他版本的 `-main` | 315 | 2. 根据影响范围 cherry-pick 到其他版本的 `-main` |
| 310 | 3. 如需发布,再 cherry-pick 到对应的 `-stable` | 316 | 3. 如需发布,再 cherry-pick 到对应的 `-stable` |
| 311 | 4. 记录修复的 commit hash 和影响范围 | 317 | 4. 记录修复的 commit hash 和影响范围 |
| 312 | 318 | ||
| 313 | -### Q3:main 分支的代码可以直接合入 0.82-main 吗? | 319 | +### Q3:`0.88-preview` 的代码可以直接合入旧版本线吗? |
| 320 | + | ||
| 321 | +**A**:不允许直接合并。`0.88-preview` 是 0.88 适配分支;若需进入既有正式版本线(如 `0.82-main`、`0.84-main`),应: | ||
| 314 | 322 | ||
| 315 | -**A**:不允许直接合并。main 用于探索,若需进入正式版本,应: | ||
| 316 | - 通过特性分支在对应版本演进主干上重新实现 | 323 | - 通过特性分支在对应版本演进主干上重新实现 |
| 317 | - 或通过 cherry-pick 选择性地移植稳定改动 | 324 | - 或通过 cherry-pick 选择性地移植稳定改动 |
| 318 | 325 | ||
| 319 | ### Q4:如何处理合并冲突? | 326 | ### Q4:如何处理合并冲突? |
| 320 | 327 | ||
| 321 | **A**: | 328 | **A**: |
| 329 | + | ||
| 322 | 1. 在本地解决冲突 | 330 | 1. 在本地解决冲突 |
| 323 | 2. 运行完整测试套件 | 331 | 2. 运行完整测试套件 |
| 324 | 3. 请相关 Maintainer 协助审查 | 332 | 3. 请相关 Maintainer 协助审查 |
| @@ -327,6 +335,7 @@ main (探索) | |||
| 327 | ### Q5:发布分支可以接受新特性吗? | 335 | ### Q5:发布分支可以接受新特性吗? |
| 328 | 336 | ||
| 329 | **A**:不可以。发布分支仅接受: | 337 | **A**:不可以。发布分支仅接受: |
| 338 | + | ||
| 330 | - 关键 bug 修复 | 339 | - 关键 bug 修复 |
| 331 | - 安全补丁 | 340 | - 安全补丁 |
| 332 | - 兼容性修复 | 341 | - 兼容性修复 |
| @@ -336,6 +345,7 @@ main (探索) | |||
| 336 | ### Q6:如何回滚发布? | 345 | ### Q6:如何回滚发布? |
| 337 | 346 | ||
| 338 | **A**: | 347 | **A**: |
| 348 | + | ||
| 339 | 1. 创建回滚 PR(revert commit) | 349 | 1. 创建回滚 PR(revert commit) |
| 340 | 2. 按正常流程审查和合并 | 350 | 2. 按正常流程审查和合并 |
| 341 | 3. 重新打标签(如 `v0.82.1-ga`) | 351 | 3. 重新打标签(如 `v0.82.1-ga`) |
| @@ -411,6 +421,7 @@ graph LR | |||
| 411 | --- | 421 | --- |
| 412 | 422 | ||
| 413 | ## 附录 | 423 | ## 附录 |
| 424 | + | ||
| 414 | ### A. 联系方式 | 425 | ### A. 联系方式 |
| 415 | 426 | ||
| 416 | - **RN Sig 工作组**:[邮件列表] | 427 | - **RN Sig 工作组**:[邮件列表] |
| @@ -419,4 +430,4 @@ graph LR | |||
| 419 | 430 | ||
| 420 | --- | 431 | --- |
| 421 | 432 | ||
| 422 | -*文档版本:v1.0 | 最后更新:2026年3月* | 433 | +_文档版本:v1.0 | 最后更新:2026年3月_ |
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | main分支为版本持续演进分支,会根据 React Native 版本的演进,持续更新 RNOH 框架的适配版本。历史版本的适配在特性分支上进行。可参考[RNOH版本演进规划和分支策略](./仓库分支管理规范.md)。 | 5 | main分支为版本持续演进分支,会根据 React Native 版本的演进,持续更新 RNOH 框架的适配版本。历史版本的适配在特性分支上进行。可参考[RNOH版本演进规划和分支策略](./仓库分支管理规范.md)。 |
| 6 | 。 | 6 | 。 |
| 7 | + | ||
| 7 | --- | 8 | --- |
| 8 | 9 | ||
| 9 | ## 一、开发环境搭建与启动 | 10 | ## 一、开发环境搭建与启动 |
| @@ -12,12 +13,12 @@ main分支为版本持续演进分支,会根据 React Native 版本的演进 | |||
| 12 | 13 | ||
| 13 | ### 1. 前置条件 | 14 | ### 1. 前置条件 |
| 14 | 15 | ||
| 15 | -| 序号 | 条件 | 说明 | | 16 | +| 序号 | 条件 | 说明 | |
| 16 | -|:---:|------|------| | 17 | +| :--: | --------------------------- | ------------------------------------------------------------------------------------------------------------------ | |
| 17 | -| 1 | HarmonyOS NEXT 模拟器或真机 | 本项目需要在 HarmonyOS NEXT 上进行测试 | | 18 | +| 1 | HarmonyOS NEXT 模拟器或真机 | 本项目需要在 HarmonyOS NEXT 上进行测试 | |
| 18 | -| 2 | 华为开发者账号 | 运行应用程序时需要[华为开发者账号](https://developer.huawei.com/consumer/cn/personalcenter/overview)对应用进行签名 | | 19 | +| 2 | 华为开发者账号 | 运行应用程序时需要[华为开发者账号](https://developer.huawei.com/consumer/cn/personalcenter/overview)对应用进行签名 | |
| 19 | -| 3 | DevEco Studio | 从[官网](https://developer.huawei.com/consumer/cn/deveco-studio/)下载并安装最新版本 | | 20 | +| 3 | DevEco Studio | 从[官网](https://developer.huawei.com/consumer/cn/deveco-studio/)下载并安装最新版本 | |
| 20 | -| 4 | Node.js v22.11+ | 参考[官网指导](https://nodejs.org/en/download)安装 Node.js v22.11+ 或更高版本 | | 21 | +| 4 | Node.js v22.11+ | 参考[官网指导](https://nodejs.org/en/download)安装 Node.js v22.11+ 或更高版本 | |
| 21 | 22 | ||
| 22 | ### 2. 框架开发启动 | 23 | ### 2. 框架开发启动 |
| 23 | 24 | ||
| @@ -29,19 +30,19 @@ git clone https://gitcode.com/CPF-RN/ohos_react_native.git && cd ohos_react_nati | |||
| 29 | 30 | ||
| 30 | ### 3. 详细步骤说明 | 31 | ### 3. 详细步骤说明 |
| 31 | 32 | ||
| 32 | -| 步骤 | 操作 | 命令/说明 | | 33 | +| 步骤 | 操作 | 命令/说明 | |
| 33 | -|:---:|------|----------| | 34 | +| :--: | ------------------ | ---------------------------------------------------------------- | |
| 34 | -| 1 | 拉取项目代码 | `git clone https://gitcode.com/CPF-RN/ohos_react_native.git` | | 35 | +| 1 | 拉取项目代码 | `git clone https://gitcode.com/CPF-RN/ohos_react_native.git` | |
| 35 | -| 2 | 进入项目目录 | `cd ohos_react_native` | | 36 | +| 2 | 进入项目目录 | `cd ohos_react_native` | |
| 36 | -| 3 | 切换分支 | `git switch main`(React Native 演进版本的适配在特性分支上进行) | | 37 | +| 3 | 切换分支 | `git switch main`(React Native 演进版本的适配在特性分支上进行) | |
| 37 | -| 4 | 安装 pnpm | `npm install -g pnpm@latest-10` | | 38 | +| 4 | 安装 pnpm | `npm install -g pnpm@latest-10` | |
| 38 | -| 5 | 项目初始化 | `pnpm init-ws`(拉取 submodule 和安装 npm 依赖,耗时较长) | | 39 | +| 5 | 项目初始化 | `pnpm init-ws`(拉取 submodule 和安装 npm 依赖,耗时较长) | |
| 39 | -| 6 | 连接设备 | 连接设备并开启 USB 调试,或启动模拟器 | | 40 | +| 6 | 连接设备 | 连接设备并开启 USB 调试,或启动模拟器 | |
| 40 | -| 7 | 启动测试工具 | `pnpm dev`(启动 metro 和测试工具) | | 41 | +| 7 | 启动测试工具 | `pnpm dev`(启动 metro 和测试工具) | |
| 41 | -| 8 | 打开 DevEco Studio | 打开 `packages/tester/harmony` 项目,等待后台同步完成 | | 42 | +| 8 | 打开 DevEco Studio | 打开 `packages/tester/harmony` 项目,等待后台同步完成 | |
| 42 | -| 9 | 完成签名 | File > Project Structure > Signing Configs,登录并完成签名 | | 43 | +| 9 | 完成签名 | File > Project Structure > Signing Configs,登录并完成签名 | |
| 43 | -| 10 | 选择配置 | 右上角项目配置下拉中选中 `entry` | | 44 | +| 10 | 选择配置 | 右上角项目配置下拉中选中 `entry` | |
| 44 | -| 11 | 运行项目 | 点击右上角绿色三角箭头【Run 'entry'】按钮 | | 45 | +| 11 | 运行项目 | 点击右上角绿色三角箭头【Run 'entry'】按钮 | |
| 45 | 46 | ||
| 46 | > **说明**:tester 项目主要用于开发过程中的自测试。如运行 tester 用例时遇到问题,请提 [issue](https://gitcode.com/CPF-RN/ohos_react_native/issues) 咨询。 | 47 | > **说明**:tester 项目主要用于开发过程中的自测试。如运行 tester 用例时遇到问题,请提 [issue](https://gitcode.com/CPF-RN/ohos_react_native/issues) 咨询。 |
| 47 | 48 | ||
| @@ -84,6 +85,7 @@ pnpm install | |||
| 84 | ``` | 85 | ``` |
| 85 | 86 | ||
| 86 | 执行后自动完成以下配置: | 87 | 执行后自动完成以下配置: |
| 88 | + | ||
| 87 | - 安装 husky、commitlint、standard-version 等依赖 | 89 | - 安装 husky、commitlint、standard-version 等依赖 |
| 88 | - 创建 `.husky/` 目录及 `commit-msg`、`pre-push` 钩子 | 90 | - 创建 `.husky/` 目录及 `commit-msg`、`pre-push` 钩子 |
| 89 | - 配置 Git hooks 路径 | 91 | - 配置 Git hooks 路径 |
| @@ -98,8 +100,8 @@ chmod +x .husky/commit-msg .husky/pre-push | |||
| 98 | 100 | ||
| 99 | 根据《[仓库分支管理规范](./仓库分支管理规范.md)》,基于远程分支创建个人开发分支: | 101 | 根据《[仓库分支管理规范](./仓库分支管理规范.md)》,基于远程分支创建个人开发分支: |
| 100 | 102 | ||
| 101 | -| 分支类型 | 命名规范 | 示例 | | 103 | +| 分支类型 | 命名规范 | 示例 | |
| 102 | -| ---- | --------------------------- | ----------------------- | | 104 | +| -------- | --------------------------- | ----------------------- | |
| 103 | | 特性分支 | `${version}-feature/<name>` | `0.82-feature/new-arch` | | 105 | | 特性分支 | `${version}-feature/<name>` | `0.82-feature/new-arch` | |
| 104 | | 修复分支 | `${version}-hotfix/<issue>` | `0.82-hotfix/123` | | 106 | | 修复分支 | `${version}-hotfix/<issue>` | `0.82-hotfix/123` | |
| 105 | 107 | ||
| @@ -154,9 +156,9 @@ Signed-off-by: 张三 <zhangsan@example.com> | |||
| 154 | 156 | ||
| 155 | 当你提交 Pull Request (PR) 时,平台机器人会自动进行 DCO 校验。校验失败通常由以下原因导致,可以这样解决: | 157 | 当你提交 Pull Request (PR) 时,平台机器人会自动进行 DCO 校验。校验失败通常由以下原因导致,可以这样解决: |
| 156 | 158 | ||
| 157 | -| 失败原因 | 解决方案 | | 159 | +| 失败原因 | 解决方案 | |
| 158 | -| :------------------------------ | :---------------------------------------------------------------------------------------- | | 160 | +| :----------------------------------- | :----------------------------------------------------------------------------------------------------------------------------- | |
| 159 | -| **未签署 DCO 协议** | 点击机器人提供的链接,在线签署协议。然后,在 PR 评论区输入 `check dco` 并发表评论,让系统重新检查 | | 161 | +| **未签署 DCO 协议** | 点击机器人提供的链接,在线签署协议。然后,在 PR 评论区输入 `check dco` 并发表评论,让系统重新检查 | |
| 160 | | **Commit 中缺少 Signed-off-by 信息** | 使用 `git commit --amend --signoff` 为提交补充签名,然后强制推送更新 PR。完成后,同样在 PR 评论区输入 `check dco` 触发重新校验 | | 162 | | **Commit 中缺少 Signed-off-by 信息** | 使用 `git commit --amend --signoff` 为提交补充签名,然后强制推送更新 PR。完成后,同样在 PR 评论区输入 `check dco` 触发重新校验 | |
| 161 | 163 | ||
| 162 | #### 💎 关键点与提示 | 164 | #### 💎 关键点与提示 |
| @@ -174,6 +176,7 @@ Signed-off-by: 张三 <zhangsan@example.com> | |||
| 174 | 示例(根据文件类型选择对应格式): | 176 | 示例(根据文件类型选择对应格式): |
| 175 | 177 | ||
| 176 | **TypeScript/JavaScript 文件:** | 178 | **TypeScript/JavaScript 文件:** |
| 179 | + | ||
| 177 | ```typescript | 180 | ```typescript |
| 178 | /** | 181 | /** |
| 179 | * Copyright (c) [年份] [开发者名称/公司名称] | 182 | * Copyright (c) [年份] [开发者名称/公司名称] |
| @@ -184,6 +187,7 @@ Signed-off-by: 张三 <zhangsan@example.com> | |||
| 184 | ``` | 187 | ``` |
| 185 | 188 | ||
| 186 | **C/C++ 文件:** | 189 | **C/C++ 文件:** |
| 190 | + | ||
| 187 | ```cpp | 191 | ```cpp |
| 188 | /** | 192 | /** |
| 189 | * Copyright (c) [年份] [开发者名称/公司名称] | 193 | * Copyright (c) [年份] [开发者名称/公司名称] |
| @@ -231,16 +235,16 @@ git add . | |||
| 231 | 235 | ||
| 232 | #### type(类型,必选) | 236 | #### type(类型,必选) |
| 233 | 237 | ||
| 234 | -| type 值 | 对应 Changelog 类型 | 说明 | | 238 | +| type 值 | 对应 Changelog 类型 | 说明 | |
| 235 | -| :------- | :-------------- | :--------------------------- | | 239 | +| :------- | :------------------ | :--------------------------------------------------- | |
| 236 | -| feat | Added | 新增功能、特性、模块、API | | 240 | +| feat | Added | 新增功能、特性、模块、API | |
| 237 | -| fix | Fixed | 修复 Bug、异常、兼容性问题 | | 241 | +| fix | Fixed | 修复 Bug、异常、兼容性问题 | |
| 238 | -| docs | Documentation | 文档变更(新增教程、补全 API 文档、勘误等) | | 242 | +| docs | Documentation | 文档变更(新增教程、补全 API 文档、勘误等) | |
| 239 | -| style | - | 代码格式调整(不影响功能逻辑,如缩进、分号、空格等) | | 243 | +| style | - | 代码格式调整(不影响功能逻辑,如缩进、分号、空格等) | |
| 240 | -| refactor | Changed | 代码重构(既不新增功能也不修复 Bug,但改变现有逻辑) | | 244 | +| refactor | Changed | 代码重构(既不新增功能也不修复 Bug,但改变现有逻辑) | |
| 241 | -| perf | Performance | 性能优化(不改变功能逻辑) | | 245 | +| perf | Performance | 性能优化(不改变功能逻辑) | |
| 242 | -| test | - | 测试相关变更(新增 / 修改测试用例) | | 246 | +| test | - | 测试相关变更(新增 / 修改测试用例) | |
| 243 | -| chore | - | 构建流程、工具链、依赖管理相关变更(不影响用户使用) | | 247 | +| chore | - | 构建流程、工具链、依赖管理相关变更(不影响用户使用) | |
| 244 | 248 | ||
| 245 | #### scope(作用域,可选) | 249 | #### scope(作用域,可选) |
| 246 | 250 | ||
| @@ -356,7 +360,9 @@ git push origin 0.82-feature/new-arch:0.82-feature/new-arch | |||
| 356 | 360 | ||
| 357 | ```markdown | 361 | ```markdown |
| 358 | ## 变更类型 | 362 | ## 变更类型 |
| 363 | + | ||
| 359 | 请在对应类型前打 `√`,**仅可选择一项**: | 364 | 请在对应类型前打 `√`,**仅可选择一项**: |
| 365 | + | ||
| 360 | - [ ] feat(新增功能,对应 Changelog Added) | 366 | - [ ] feat(新增功能,对应 Changelog Added) |
| 361 | - [ ] fix(修复 Bug,对应 Changelog Fixed) | 367 | - [ ] fix(修复 Bug,对应 Changelog Fixed) |
| 362 | - [ ] docs(文档变更,对应 Changelog Documentation) | 368 | - [ ] docs(文档变更,对应 Changelog Documentation) |
| @@ -366,19 +372,23 @@ git push origin 0.82-feature/new-arch:0.82-feature/new-arch | |||
| 366 | - [ ] chore(构建/工具链/依赖,不进入 Changelog) | 372 | - [ ] chore(构建/工具链/依赖,不进入 Changelog) |
| 367 | 373 | ||
| 368 | ## 变更内容 | 374 | ## 变更内容 |
| 375 | + | ||
| 369 | - 简要描述本次变更的具体内容、解决的问题; | 376 | - 简要描述本次变更的具体内容、解决的问题; |
| 370 | - 若为**破坏性变更**,请详细说明: | 377 | - 若为**破坏性变更**,请详细说明: |
| 371 | - 影响范围(哪些 API/配置/功能被修改); | 378 | - 影响范围(哪些 API/配置/功能被修改); |
| 372 | - 用户适配方案(旧版→新版的替换步骤) | 379 | - 用户适配方案(旧版→新版的替换步骤) |
| 373 | 380 | ||
| 374 | ## 测试步骤 | 381 | ## 测试步骤 |
| 375 | -<!-- | 382 | + |
| 383 | +<!-- | ||
| 376 | 如何测试这条PR。例如: | 384 | 如何测试这条PR。例如: |
| 377 | 1. 打开Tester工程. | 385 | 1. 打开Tester工程. |
| 378 | 2. 执行npm run start命令. | 386 | 2. 执行npm run start命令. |
| 379 | ... | 387 | ... |
| 380 | --> | 388 | --> |
| 389 | + | ||
| 381 | ## 测试情况 | 390 | ## 测试情况 |
| 391 | + | ||
| 382 | - [ ] 已通过本地完整测试(单元测试/集成测试) | 392 | - [ ] 已通过本地完整测试(单元测试/集成测试) |
| 383 | - [ ] 已通过 CI 自动构建与测试 | 393 | - [ ] 已通过 CI 自动构建与测试 |
| 384 | - [ ] 已补充/更新对应的测试用例 | 394 | - [ ] 已补充/更新对应的测试用例 |
| @@ -386,11 +396,13 @@ git push origin 0.82-feature/new-arch:0.82-feature/new-arch | |||
| 386 | - [ ] 已在最低兼容环境(如 API12)验证功能 | 396 | - [ ] 已在最低兼容环境(如 API12)验证功能 |
| 387 | 397 | ||
| 388 | ## 合入前自检 | 398 | ## 合入前自检 |
| 399 | + | ||
| 389 | <!-- | 400 | <!-- |
| 390 | 请在合入前根据以下条例进行自检 | 401 | 请在合入前根据以下条例进行自检 |
| 391 | 自检完成后在[ ]内填入"x", 例如: | 402 | 自检完成后在[ ]内填入"x", 例如: |
| 392 | - [x] 不涉及非兼容性变更;若涉及,已通过相应评审。 | 403 | - [x] 不涉及非兼容性变更;若涉及,已通过相应评审。 |
| 393 | --> | 404 | --> |
| 405 | + | ||
| 394 | - [ ] 不涉及非兼容性变更;若涉及,已通过相应评审。 | 406 | - [ ] 不涉及非兼容性变更;若涉及,已通过相应评审。 |
| 395 | - [ ] 不涉及性能或已进行性能测试且无性能劣化。 | 407 | - [ ] 不涉及性能或已进行性能测试且无性能劣化。 |
| 396 | - [ ] 符合对应的编码规范。 | 408 | - [ ] 符合对应的编码规范。 |
| @@ -443,17 +455,21 @@ Changelog 需与 Commit、PR 联动,确保变更可追溯,操作要求如下 | |||
| 443 | ## [Unreleased] | 455 | ## [Unreleased] |
| 444 | 456 | ||
| 445 | ### Added | 457 | ### Added |
| 458 | + | ||
| 446 | - 新增 XX 功能模块,支持 XX 能力 | 459 | - 新增 XX 功能模块,支持 XX 能力 |
| 447 | 460 | ||
| 448 | ### Fixed | 461 | ### Fixed |
| 462 | + | ||
| 449 | - 修复 XX 场景下的崩溃问题 | 463 | - 修复 XX 场景下的崩溃问题 |
| 450 | 464 | ||
| 451 | ## [1.2.0] - 2026-03-15 | 465 | ## [1.2.0] - 2026-03-15 |
| 452 | 466 | ||
| 453 | ### Added | 467 | ### Added |
| 468 | + | ||
| 454 | - 新增用户二次验证功能,支持短信/邮箱验证码双渠道 | 469 | - 新增用户二次验证功能,支持短信/邮箱验证码双渠道 |
| 455 | 470 | ||
| 456 | ### Fixed | 471 | ### Fixed |
| 472 | + | ||
| 457 | - 修复了分页查询时页码超出范围返回异常的问题 | 473 | - 修复了分页查询时页码超出范围返回异常的问题 |
| 458 | 474 | ||
| 459 | [Unreleased]: https://gitcode.com/{用户名}/{仓库名}/compare/v1.2.0...HEAD | 475 | [Unreleased]: https://gitcode.com/{用户名}/{仓库名}/compare/v1.2.0...HEAD |
| @@ -462,14 +478,14 @@ Changelog 需与 Commit、PR 联动,确保变更可追溯,操作要求如下 | |||
| 462 | 478 | ||
| 463 | #### 变更类型分类 | 479 | #### 变更类型分类 |
| 464 | 480 | ||
| 465 | -| 类型(英文 / 中文) | 适用场景 | | 481 | +| 类型(英文 / 中文) | 适用场景 | |
| 466 | -| :-------------- | :------------------------------------- | | 482 | +| :------------------ | :------------------------------------------------------------------ | |
| 467 | -| Added / 新增 | 新增功能、特性、模块、API、配置项、文档、依赖等 | | 483 | +| Added / 新增 | 新增功能、特性、模块、API、配置项、文档、依赖等 | |
| 468 | -| Changed / 变更 | 现有功能的逻辑、行为、UI、API 入参 / 出参、依赖版本、默认配置的修改 | | 484 | +| Changed / 变更 | 现有功能的逻辑、行为、UI、API 入参 / 出参、依赖版本、默认配置的修改 | |
| 469 | -| Deprecated / 弃用 | 计划在未来版本中移除的功能、API、配置项 | | 485 | +| Deprecated / 弃用 | 计划在未来版本中移除的功能、API、配置项 | |
| 470 | -| Removed / 移除 | 本版本中正式移除的、已在之前版本标记为弃用的功能、API、配置项、依赖 | | 486 | +| Removed / 移除 | 本版本中正式移除的、已在之前版本标记为弃用的功能、API、配置项、依赖 | |
| 471 | -| Fixed / 修复 | 各类 Bug、异常、兼容性问题的修复 | | 487 | +| Fixed / 修复 | 各类 Bug、异常、兼容性问题的修复 | |
| 472 | -| Security / 安全 | 安全漏洞、隐私合规相关的修复与优化 | | 488 | +| Security / 安全 | 安全漏洞、隐私合规相关的修复与优化 | |
| 473 | 489 | ||
| 474 | ### 3. 自动化生成 | 490 | ### 3. 自动化生成 |
| 475 | 491 | ||
| @@ -485,13 +501,13 @@ Changelog 需与 Commit、PR 联动,确保变更可追溯,操作要求如下 | |||
| 485 | 501 | ||
| 486 | ### 1. 分支类型与用途 | 502 | ### 1. 分支类型与用途 |
| 487 | 503 | ||
| 488 | -| 分支类型 | 命名规范 | 用途 | | 504 | +| 分支类型 | 命名规范 | 用途 | |
| 489 | -| ------ | --------------------------- | ----------------- | | 505 | +| ------------ | --------------------------- | ---------------------------------- | |
| 490 | -| 主干 | `main` | 下一代探索开发(0.84) | | 506 | +| 主干 | `main` | 当前版本线演进基线(现为 0.88) | |
| 491 | -| 版本演进主干 | `${version}-main` | 对应版本的日常开发、功能迭代 | | 507 | +| 版本演进主干 | `${version}-main` | 对应版本的日常开发、功能迭代 | |
| 492 | -| 商业发布分支 | `${version}-stable` | 商业版本交付,仅关键修复 | | 508 | +| 商业发布分支 | `${version}-stable` | 商业版本交付,仅关键修复 | |
| 493 | -| 特性分支 | `${version}-feature/<name>` | 大型特性隔离开发 | | 509 | +| 特性分支 | `${version}-feature/<name>` | 大型特性隔离开发 | |
| 494 | -| 修复分支 | `${version}-hotfix/<issue>` | 紧急修复,合并至演进主干及发布分支 | | 510 | +| 修复分支 | `${version}-hotfix/<issue>` | 紧急修复,合并至演进主干及发布分支 | |
| 495 | 511 | ||
| 496 | ### 2. 分支合并流程 | 512 | ### 2. 分支合并流程 |
| 497 | 513 | ||
| @@ -510,7 +526,7 @@ Changelog 需与 Commit、PR 联动,确保变更可追溯,操作要求如下 | |||
| 510 | 526 | ||
| 511 | 若多个版本需要同一个修复: | 527 | 若多个版本需要同一个修复: |
| 512 | 528 | ||
| 513 | -1. 优先合入最新演进主干(如 `0.82-main`) | 529 | +1. 优先合入最新演进主干(当前为 `main` / 0.88,或目标版本的 `0.XX-main`) |
| 514 | 2. 根据影响范围 cherry-pick 到其他版本的 `-main` | 530 | 2. 根据影响范围 cherry-pick 到其他版本的 `-main` |
| 515 | 3. 如需发布,再 cherry-pick 到对应的 `-stable` | 531 | 3. 如需发布,再 cherry-pick 到对应的 `-stable` |
| 516 | 4. 记录修复的 commit hash 和影响范围 | 532 | 4. 记录修复的 commit hash 和影响范围 |
| @@ -559,7 +575,7 @@ PR 审核时会提醒补充,若已合并,可提交新的 PR 补充 Changelog | |||
| 559 | 575 | ||
| 560 | 若有疑问,可查看社区规范文档或在社区群咨询维护者。 | 576 | 若有疑问,可查看社区规范文档或在社区群咨询维护者。 |
| 561 | 577 | ||
| 562 | -*** | 578 | +--- |
| 563 | 579 | ||
| 564 | **相关规范文档**: | 580 | **相关规范文档**: |
| 565 | 581 | ||
| @@ -568,6 +584,6 @@ PR 审核时会提醒补充,若已合并,可提交新的 PR 补充 Changelog | |||
| 568 | - [仓库分支管理规范](./仓库分支管理规范.md) | 584 | - [仓库分支管理规范](./仓库分支管理规范.md) |
| 569 | - [社区 Issue 管理规范](./社区issue管理规范.md) | 585 | - [社区 Issue 管理规范](./社区issue管理规范.md) |
| 570 | 586 | ||
| 571 | -*** | 587 | +--- |
| 572 | 588 | ||
| 573 | -*文档版本:v1.0 | 最后更新:2026年4月* | 589 | +_文档版本:v1.0 | 最后更新:2026年4月_ |
| @@ -450,7 +450,7 @@ body: | |||
| 450 | attributes: | 450 | attributes: |
| 451 | label: React Native OpenHarmony 版本。 | 451 | label: React Native OpenHarmony 版本。 |
| 452 | description: 请提供您使用的React Native OpenHarmony版本信息。 | 452 | description: 请提供您使用的React Native OpenHarmony版本信息。 |
| 453 | - placeholder: "0.86.1" | 453 | + placeholder: "0.88.1" |
| 454 | validations: | 454 | validations: |
| 455 | required: true | 455 | required: true |
| 456 | - type: textarea | 456 | - type: textarea |
| @@ -515,7 +515,7 @@ body: | |||
| 515 | attributes: | 515 | attributes: |
| 516 | label: React Native OpenHarmony 版本。 | 516 | label: React Native OpenHarmony 版本。 |
| 517 | description: 请提供您使用的React Native OpenHarmony版本信息。 | 517 | description: 请提供您使用的React Native OpenHarmony版本信息。 |
| 518 | - placeholder: "0.86.1" | 518 | + placeholder: "0.88.1" |
| 519 | validations: | 519 | validations: |
| 520 | required: true | 520 | required: true |
| 521 | - type: textarea | 521 | - type: textarea |
| @@ -1,12 +1,12 @@ | |||
| 1 | # 社区符号表归档规范 | 1 | # 社区符号表归档规范 |
| 2 | 2 | ||
| 3 | -| 项目 | 说明 | | 3 | +| 项目 | 说明 | |
| 4 | -| ------------ | ---------------------------------------------------------------------- | | 4 | +| ------------ | ---------------------------------------------------------------------------- | |
| 5 | -| **适用范围** | RNOH 各版本线(0.72 / 0.77 / 0.82 / 0.84 / 0.86 …)的正式发布与预发布 | | 5 | +| **适用范围** | RNOH 各版本线(0.72 / 0.77 / 0.82 / 0.84 / 0.86 / 0.88 …)的正式发布与预发布 | |
| 6 | -| **归档对象** | Release HAR 内自研与预编译 `.so` 对应的符号文件(`.sym`) | | 6 | +| **归档对象** | Release HAR 内自研与预编译 `.so` 对应的符号文件(`.sym`) | |
| 7 | -| **归档位置** | GitCode RNOH 主仓库对应版本 Release 页面(附件 + 正文符号链接表) | | 7 | +| **归档位置** | GitCode RNOH 主仓库对应版本 Release 页面(附件 + 正文符号链接表) | |
| 8 | -| **匹配键** | ELF BuildID | | 8 | +| **匹配键** | ELF BuildID | |
| 9 | -| **核心目标** | 任意历史版本的线上崩溃均可符号化;符号与发布物一一对应、可校验、不可变 | | 9 | +| **核心目标** | 任意历史版本的线上崩溃均可符号化;符号与发布物一一对应、可校验、不可变 | |
| 10 | 10 | ||
| 11 | ## 目录 | 11 | ## 目录 |
| 12 | 12 | ||
| @@ -84,7 +84,7 @@ rnoh-symbols-[RNOH版本号]-[构建配置].tar.gz | |||
| 84 | 示例: | 84 | 示例: |
| 85 | 85 | ||
| 86 | ```text | 86 | ```text |
| 87 | -rnoh-symbols-0.86.1-release.tar.gz | 87 | +rnoh-symbols-0.88.1-release.tar.gz |
| 88 | ``` | 88 | ``` |
| 89 | 89 | ||
| 90 | ### 2. 包内结构 | 90 | ### 2. 包内结构 |
| @@ -92,7 +92,7 @@ rnoh-symbols-0.86.1-release.tar.gz | |||
| 92 | 当前仅 arm64-v8a,符号文件平铺;启用 x86_64 构建后按架构分子目录。 | 92 | 当前仅 arm64-v8a,符号文件平铺;启用 x86_64 构建后按架构分子目录。 |
| 93 | 93 | ||
| 94 | ```text | 94 | ```text |
| 95 | -rnoh-symbols-0.86.1-release.tar.gz | 95 | +rnoh-symbols-0.88.1-release.tar.gz |
| 96 | ├── libhermestooling.so.sym | 96 | ├── libhermestooling.so.sym |
| 97 | ├── libhermesvm.so.sym | 97 | ├── libhermesvm.so.sym |
| 98 | ├── libjsi.so.sym | 98 | ├── libjsi.so.sym |
| @@ -119,20 +119,22 @@ Release 正文必须包含符号链接表(对齐上游格式)与 BuildID 表 | |||
| 119 | 119 | ||
| 120 | ```markdown | 120 | ```markdown |
| 121 | RNOH Symbols: | 121 | RNOH Symbols: |
| 122 | -- Release: rnoh-symbols-0.86.1-release.tar.gz(覆盖 release.har 与 release2.har) | 122 | + |
| 123 | +- Release: rnoh-symbols-0.88.1-release.tar.gz | ||
| 124 | +- Release2: rnoh-symbols-0.88.1-release2.tar.gz(native 构建与 release 不一致,单独归档) | ||
| 123 | - Debug: 不归档(源码包由伙伴自行编译,符号自包含) | 125 | - Debug: 不归档(源码包由伙伴自行编译,符号自包含) |
| 124 | 126 | ||
| 125 | -| 模块 | BuildID | | 127 | +| 模块 | BuildID | |
| 126 | -|------|---------| | 128 | +| ----------------------- | ---------------------------------------- | |
| 127 | -| libhermestooling.so | 0426452f9714d449fef5df1d8c9d647aa3418fb9 | | 129 | +| libhermestooling.so | 8948dacdd6411f70c4202b527c558ea891044c86 | |
| 128 | -| libhermesvm.so | c09dd5a82a16e41f1cb5a9c3abc42925286cf48e | | 130 | +| libhermesvm.so | 9ba68b4dd3f8c3cdb7092cb93e02f984b8507e70 | |
| 129 | -| libjsi.so | 1ee871fa7f3cc9f370faafb1a8d604569142955b | | 131 | +| libjsi.so | 35e3ff21c3c7290b160e51531257d01486f329c6 | |
| 130 | -| libjsvmtooling.so | b147bae673b816363f85aa992dccbe7acf1b807f | | 132 | +| libjsvmtooling.so | 84324e5061f93b4e0f6880880e61f8157a34a651 | |
| 131 | -| libreactnative.so | 690f4aa51053e41bb7ab308316124637fc315e94 | | 133 | +| libreactnative.so | 847e6259560549acfd40ec567f2b4fb8681d849c | |
| 132 | -| librnoh_core.so | 51daea39d125a3934d8d704e548bdc50b3371015 | | 134 | +| librnoh_core.so | fc83d55f3fb09938d488404867cf1ceb9db69fe1 | |
| 133 | -| librnoh_core_package.so | 12f2fa2cc882a7e9a6c9548d9dcfdc3596648723 | | 135 | +| librnoh_core_package.so | c0566be85bcc9094be044e12969eee9db0b395a7 | |
| 134 | 136 | ||
| 135 | -> Hermes: 250829098.0.17 / 3477757eb2475555cf8d8df24bfb1deb0613880d(for RN 0.86.3,RNOH 独立编译,BuildID 与上游不同,不可用上游符号替代) | 137 | +> Hermes: 260318099.0.5 / 9a115f15785851f4ff2747ebb090ddd066fc8ad2(for RN 0.88.1,RNOH 独立编译,BuildID 与上游不同,不可用上游符号替代) |
| 136 | ``` | 138 | ``` |
| 137 | 139 | ||
| 138 | **说明**: | 140 | **说明**: |