indiespirit / react-native-chart-kit

πŸ“ŠReact Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)
https://expo.io/@indiespirit/react-native-chart-kit
MIT License
2.85k stars 658 forks source link

Unknown event handler property `onPress` #704

Open mykelcodes opened 1 year ago

mykelcodes commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-chart-kit@6.12.0 for the project I'm working on.

Using this library in an Expo project that requires a chart. On web, I ran into an issue where onDataPointClick was not working for LineChart.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-chart-kit/dist/line-chart/LineChart.js b/node_modules/react-native-chart-kit/dist/line-chart/LineChart.js
index 1ac4227..0aeda86 100644
--- a/node_modules/react-native-chart-kit/dist/line-chart/LineChart.js
+++ b/node_modules/react-native-chart-kit/dist/line-chart/LineChart.js
@@ -94,7 +94,7 @@ var LineChart = /** @class */ (function (_super) {
                     };
                     output.push(<Circle key={Math.random()} cx={cx} cy={cy} fill={typeof getDotColor === "function"
                         ? getDotColor(x, i)
-                        : _this.getColor(dataset, 0.9)} onPress={onPress} {..._this.getPropsForDots(x, i)}/>, <Circle key={Math.random()} cx={cx} cy={cy} r="14" fill="#fff" fillOpacity={0} onPress={onPress}/>, renderDotContent({ x: cx, y: cy, index: i, indexData: x }));
+                        : _this.getColor(dataset, 0.9)} onPress={onPress} onClick={onPress} {..._this.getPropsForDots(x, i)}/>, <Circle key={Math.random()} cx={cx} cy={cy} r="14" fill="#fff" fillOpacity={0} onPress={onPress} onClick={onPress}/>, renderDotContent({ x: cx, y: cy, index: i, indexData: x }));
                 });
             });
             return output;
Demven commented 10 months ago

I have the same issue on Web. Please make a patch with the proposed solution. I love your library, but I can't move forward with adapting it to work on Web.... Any estimates when this can be released?