Skip to content

Switch charting from react-native-charts-wrapper to @wuba/react-native-echarts#137

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/switch-to-react-native-echarts
Draft

Switch charting from react-native-charts-wrapper to @wuba/react-native-echarts#137
Copilot wants to merge 2 commits intomainfrom
copilot/switch-to-react-native-echarts

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 31, 2026

react-native-charts-wrapper wraps Android/iOS-specific native chart libraries and doesn't generalise to other platforms. @wuba/react-native-echarts builds on Apache ECharts using the already-present react-native-svg, giving better cross-platform portability and a richer chart API.

Dependency changes

  • Remove react-native-charts-wrapper + @types/react-native-charts-wrapper
  • Add @wuba/react-native-echarts ^3.0.1, echarts ^5.4.3, zrender ^5.4.4
  • Add the three new packages to Jest's transformIgnorePatterns exception list

AttemptsChart

Replaces CombinedChart with ECharts scatter + line series rendered via SvgChart. Visuals preserved: scatter of individual attempts, dashed yellow best-time line, configurable sliding-average lines.

TPSChart

Replaces LineChart with ECharts line series + areaStyle linear gradient. Smooth curve, gradient fill, and optional playback-position marker all preserved. Notably, atTimestamp updates on every playback frame — the two-effect pattern (init on layout, setOption on data) avoids full chart recreation on each frame.

Pattern used in both charts

// Effect 1: create chart instance only when container dimensions change
useEffect(() => {
  chartInstance.current = echarts.init(chartRef.current, null, { renderer: 'svg', width, height });
  return () => { chartInstance.current?.dispose(); chartInstance.current = null; };
}, [width, height]);

// Effect 2: update options without recreating the chart
useEffect(() => {
  chartInstance.current?.setOption({ /* data/theme-driven options */ });
}, [width, height, /* data deps */]);

Stale chart snapshots deleted; they will regenerate on next test run.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI linked an issue Mar 31, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Consider switching to react-native-echarts for better performance Switch charting from react-native-charts-wrapper to @wuba/react-native-echarts Mar 31, 2026
Copilot AI requested a review from thehale March 31, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider switching to react-native-echarts

3 participants