Skip to content

React Native support #16

Description

@hoangman1108

Summary

Would love to use Liveline in React Native apps. The current implementation is canvas-based (HTML <canvas> + requestAnimationFrame) which doesn't run in RN environments.

Use case

Real-time price charts and live data dashboards are a common need in React Native apps (trading, monitoring, sports data). Liveline's feature set — smooth lerp, candlestick mode, multi-series, momentum indicators — is a strong match for native mobile, where equivalent libraries are sparse.

Technical gap

Web React Native equivalent
<canvas> + 2D context @shopify/react-native-skia or react-native-svg
ResizeObserver View onLayout callback
Mouse events (hover/scrub) PanResponder / react-native-gesture-handler
CSS cursor, className, style: CSSProperties StyleSheet / ViewStyle

react-native-skia is the most capable option — it exposes a GPU-accelerated Skia canvas with a React API, supports Path, Paint, gradients, and runs at 60/120fps. The drawing logic in src/draw/ should map fairly directly to Skia primitives.

Possible approaches

  1. Separate liveline-native package — keeps the web bundle clean, ships its own peer deps (@shopify/react-native-skia, react-native-gesture-handler). Cleanest separation.
  2. Shared core + platform renderers — extract engine/math/lerp logic into a renderer-agnostic core, then ship thin liveline/web and liveline/native entry points. More maintenance surface but avoids duplicating animation logic.
  3. react-native-svg renderer — lighter peer dep than Skia, but SVG path updates have higher JS-thread overhead at 60fps; probably fine for non-degen use cases.

Happy to help

I'm willing to contribute a proof-of-concept Skia renderer if there's interest in the direction. Let me know if you'd prefer a separate package or a renderer abstraction in this repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions