From ffe6ca4ceb13d3e898a2f2462fb675336b507c6b Mon Sep 17 00:00:00 2001 From: kafka Date: Thu, 3 Dec 2020 16:39:56 +0800 Subject: [PATCH] fixed BarChart Warning: Each child in a list should have a unique 'key' prop --- src/BarChart.tsx | 2 +- src/HelperTypes.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BarChart.tsx b/src/BarChart.tsx index 71348607..972879e2 100644 --- a/src/BarChart.tsx +++ b/src/BarChart.tsx @@ -142,7 +142,7 @@ class BarChart extends AbstractChart { flatColor: boolean; }) => { return data.map((dataset, index) => ( - + {dataset.colors?.map((color, colorIndex) => { const highOpacityColor = color(1.0); const lowOpacityColor = color(0.1); diff --git a/src/HelperTypes.ts b/src/HelperTypes.ts index b4992023..8a50c40b 100644 --- a/src/HelperTypes.ts +++ b/src/HelperTypes.ts @@ -19,6 +19,9 @@ export interface Dataset { /** Override of LineChart's withScrollableDot property just for this dataset */ withScrollableDot?: boolean; + + /** Unique key **/ + key?: string | number; } export interface ChartData {