Skip to content

[Feature]: HarmonyOS Platform Support #59

Description

@isaced

Preflight checklist

  • I searched existing issues to avoid duplicates.

Component

packages/sparkling-sdk

Problem statement

With the official release and rapid adoption of HarmonyOS NEXT (pure HarmonyOS), Huawei devices are experiencing significant market growth in China. Currently, Sparkling only supports iOS and Android platforms, which prevents coverage of HarmonyOS users and limits the market reach of cross-platform applications built with Sparkling.

Why this feature is important:

  1. Market Demand: HarmonyOS NEXT has removed Android compatibility layer and adopted a completely new HarmonyOS kernel with ArkTS technology stack, making it impossible to run Android apps directly
  2. User Coverage: Huawei devices hold a significant market share in China, especially in enterprise and government sectors
  3. Ecosystem Completeness: Supporting three major mobile platforms (iOS/Android/HarmonyOS) as a cross-platform framework will significantly enhance competitiveness
  4. First-Mover Advantage: Cross-platform frameworks' support for HarmonyOS is still in early stages; timely positioning helps establish technical barriers

Proposed solution

Add HarmonyOS platform support to packages/sparkling-sdk, following the same architecture pattern as iOS and Android:

Key Changes:

  1. New HarmonyOS SDK module (packages/sparkling-sdk/harmonyos/)

    • Implement SPKRouter for navigation management using HarmonyOS Navigation component
    • Create SPKContainerView to host Lynx runtime
    • Port scheme parameter parsing and configuration system
  2. Navigation API (consistent with existing platforms)

    // TypeScript layer - no changes needed
    import { navigate, close } from 'sparkling-navigation'
    
    navigate({
      path: 'pages/detail.lynx.bundle',
      options: { params: { title: 'Detail', itemId: '123' } }
    })
    
    close()
  3. CLI Support

    npx create-sparkling-app my-app --platforms ios,android,harmonyos
    npx sparkling build --platform harmonyos
  4. Lynx Integration

    • Integrate Lynx HarmonyOS SDK (if available)
    • Use XComponent or custom ArkUI component for rendering
    • Implement JS Bridge for native communication

The implementation would mirror the existing iOS/Android structure, reusing the TypeScript layer and adapting only the platform-specific native code.

Alternatives considered

No response

Additional context

No response

Contribution

  • I’m willing to submit a PR for this feature.
  • I’m willing to help test this feature.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions