ohos_react_native:基于 React Native 生态的 OpenHarmony 适配项目

React Native鸿蒙化仓库

Branch15Tags146
FilesLast commitLast update
5 days ago
7 months ago
1 month ago
1 month ago
1 month ago
5 days ago
7 hours ago
1 month ago
5 days ago
1 year ago
1 year ago
5 days ago
3 months ago
3 months ago
5 months ago
1 month ago
3 months ago
1 year ago
1 month ago
3 months ago
1 month ago
1 month ago
15 days ago
7 months ago
1 year ago
1 year ago
5 months ago
10 months ago
7 months ago
5 months ago
3 months ago
5 days ago
5 days ago
1 month ago
1 month ago
1 month ago
10 months ago
1 month ago
1 year ago

React Native for OpenHarmony (RNOH)

English | 简体中文

Bringing the full React Native development experience to the OpenHarmony ecosystem. High-performance bridging and full Fabric support enable RN applications to run seamlessly on OpenHarmony.

MIT License RNOH Framework RNOH Libraries


About the Project

This project adds OpenHarmony platform support to the React Native cross-platform application development framework.

Role Chinese Documentation English Documentation
Application Developer README.md README.md
Library Developer 三方库接入指南 Library Integration Guide
Maintainer or Contributor 开发者共建指南 Developer Code Contribution Guide

Documentation

🚀 Getting Started

Document Description
Environment Setup Configure the development environment
SDK Version Configuration Guide Configure SDK versions
Build Guide Build Release packages

📦 Version Management

💡 Which version to use: The default branch main of this repository is the version evolution branch (currently carrying exploratory development of new versions; stability is not guaranteed). Do not depend on it directly in production. For production adoption, install the stable version published under the npm dist-tag 0.XX-stable (for example, @react-native-oh/react-native-harmony@0.82-stable, named in alignment with upstream react-native and advanced automatically with each iteration). Current recommendation: 0.82-stable (latest GA) is the first choice for new production projects. For an overview of the status of each version line, see Stable Version Identification and Installation · Recommended Version Table.

Document Description
Stable Version Identification and Installation Version selection conclusions and recommended version matrix
Release Notes Overview of version information
Version Upgrade Guide Version upgrade workflow
Developer Adaptation Requirements for RN Upgrades Adaptation requirements for RN versions
Upstream Breaking Changes Record of breaking changes

💡 Development Documentation

Document Description
Framework Design Design principles, architecture, and interface specifications to help developers understand the framework's internals.
Development Guide Guidance from environment preparation through feature implementation.
Debugging Tools and techniques to improve debugging efficiency.
Performance Tuning Performance optimization methods, memory optimization guidance, and best practices to improve application performance and memory usage.

❓ Troubleshooting

RNOH content has been incorporated into mainstream AI models such as Gemini, DeepSeek, and GLM.

Use AI tools together with logs and context to diagnose issues quickly. Provide the error stack + RNOH version + device model to obtain precise root-cause analysis and suggested fixes.

Stability Issues

Step Action
1. Collect logs Use DevEco Studio to obtain crash logs or tombstones.
2. Analyze the stack Focus on symbols in libRNOH.so and libreact_nativemodule.so.
3. Check common causes Missing thread synchronization, incorrect NativeModule lifecycle management, and out-of-bounds memory access.
4. AI prompt "RNOH 0.82 crashes when opening a Modal on a HarmonyOS foldable device. Here is the stack: ... Please analyze possible causes."
5. Validate the solution Isolate suspected modules and use AddressSanitizer to detect errors.
Document Description
Stability Analysis Methods Methods for analyzing freezes, CppCrash, memory anomalies, and other stability issues
v0.72 Historical Fixes Fix history for version 0.72
v0.77 Historical Fixes Fix history for version 0.77
v0.82 Historical Fixes Fix history for version 0.82

Performance Issues

Step Action
1. Collect data Use React DevTools Profiler and HarmonyOS DevEco Profiler.
2. Identify bottlenecks Look for JS thread blocking, UI thread frame drops, and excessive rendering.
3. Apply optimizations Replace FlatList with FlashList, avoid anonymous functions, and enable Hermes concurrent GC.
4. AI prompt "Scrolling a long list in RNOH 0.77 is choppy, and JS thread utilization is 80%. Please suggest optimization strategies."
5. Validate Compare frame rate curves before and after optimization.

Build and Integration Issues

Step Action
1. Compilation errors Check Git submodules, CMakeLists dependencies, and RNOH/RN version compatibility.
2. Linking errors Ensure all required .so libraries are packaged and inspect symbols with readelf.
3. Module not found Check TurboModule registration and Codegen output.
4. AI prompt "My RNOH build reports undefined symbol: jsi::Value in a 0.82 environment. How can I fix this?"
5. Isolate the reproduction Create a minimal demo and add modules incrementally to identify the issue.
Document Description
RN-JS Bundling JS bundling workflow
hvigorfile Configuration Hvigor configuration guidance
Build and Symbol Management Guide Build and symbol management

Recommended workflow: Paste the error stack + version information + device model → AI provides root-cause analysis and patch suggestions → Improve efficiency by 80%.

FAQ

Document Description
FAQ Overview Frequently asked questions
Compilation FAQ Compilation issues
Runtime FAQ Runtime issues
Specification FAQ Specification questions
Issue Diagnosis and Isolation FAQ Issue diagnosis methods
Usage FAQ Usage questions

🤝 Community Governance

Document Description
Developer Contribution Guide Contribution workflow
Community Issue Management Guidelines Issue handling guidelines
Community Commit and PR Guidelines Commit and pull request guidelines
Community Changelog Guidelines Changelog guidelines
Repository Branch Management Guidelines Branch management guidelines
RNOH Package Management Guidelines npm package management guidelines

Community Communication

To be added.

Built with ❤️ by OpenHarmony React Native SIG