Mobile Development 9 min read

Taro on HarmonyOS: Evolution and Performance Optimization of a Cross-Platform Framework

This article details JD's Taro framework adaptation for HarmonyOS, tracing its evolution from ArkTS-based to C-API-driven single- and multi-threaded architectures, highlighting performance gains, feature support, and future enhancements for native-like HarmonyOS app development.

JD Tech Talk
JD Tech Talk
JD Tech Talk
Taro on HarmonyOS: Evolution and Performance Optimization of a Cross-Platform Framework

HarmonyOS has rapidly become the world's third-largest operating system, prompting a wave of native adaptations; JD's app, as a national‑level service, launched its pure‑blood HarmonyOS version in September last year and obtained Huawei’s S‑level certification.

Taro is an open‑source cross‑platform framework initiated by JD that enables developers to write once with React‑like syntax and deploy to mini‑programs, H5, React Native and native apps; it has garnered over 36,000 stars on GitHub.

The Taro on Harmony solution first attempted an ArkTS‑based bridge, which simulated a DOM/BOM environment and incurred noticeable performance penalties; when HarmonyOS opened its lower‑level C API, Taro switched to a C‑API version that creates native UI nodes directly from its virtual DOM tree.

An initial single‑threaded C‑API version placed all business logic and rendering on the main thread, causing UI jank; a later multi‑threaded version split work into three threads—JS execution, animation/rendering, and background tasks—eliminating main‑thread blocking, enabling smooth animations and supporting dynamic JS updates for hot‑patch capabilities.

Feature‑wise, Taro for Harmony fully supports React 18+ and about 33 common components (View, Text, Image, Video, etc.) with complete API coverage (getSystemInfo, getStorage, etc.) and re‑implemented complex APIs like createSelectorQuery in C++ for better performance; CSS support includes flex, positioning, selectors, media queries, units (vh, vw, calc), variables, safe‑area values, and a C++‑implemented CSSOM that mirrors browser behavior, while Yoga layout ensures W3C‑consistent positioning.

By moving most of the Taro runtime to C++, the framework achieves rendering performance comparable to native ArkTS; a dedicated long‑list component provides lazy loading, pre‑loading and node reuse to handle large data sets smoothly, and the hybrid rendering mode allows native HarmonyOS pages or components to be embedded within Taro projects.

In summary, the Taro on Harmony solution delivers native‑level performance, a multi‑threaded architecture, and dynamic update capability, marking an industry‑first validated framework for HarmonyOS app development; ongoing work explores React C++ compilation, a custom layout engine, and developer tooling for hot reloading, source mapping, break‑point debugging and element inspection to further boost efficiency and experience.

Cross‑PlatformReactHarmonyOSTaroMulti-threadingC-API
JD Tech Talk
Written by

JD Tech Talk

Official JD Tech public account delivering best practices and technology innovation.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.