diff --git a/docs/PopulationPyramid/PopulationPyramid.md b/docs/PopulationPyramid/PopulationPyramid.md index c272b45c..ba95d4f2 100644 --- a/docs/PopulationPyramid/PopulationPyramid.md +++ b/docs/PopulationPyramid/PopulationPyramid.md @@ -107,6 +107,8 @@ | barBorderRadius | number | boder radius of the bars | 0 | | leftBarBorderRadius | number | boder width of the bars displayed in the left half of the pyramid | 0 | | rightBarBorderRadius | number | boder width of the bars displayed in the right half of the pyramid | 0 | +| onLeftPress | (item, index) => void | Callback function called when a left bar is pressed. Takes 2 params- item and index. | \_ | +| onRightPress | (item, index) => void | Callback function called when a right bar is pressed. Takes 2 params- item and index. | \_ | | allCornersRounded | boolean | when set to true, border radius will apply to all the four corners of the bars, else applied only on outer edges | false | | showSurplus | boolean | shows surplus values on the edges in highlighted colors (extra width of the bigger bar is highlighted ) | false | | showSurplusLeft | boolean | shows surplus values on the left edges in highlighted colors (extra width of the bigger bar is highlighted ) | \_ | diff --git a/package.json b/package.json index 36bf4012..040df6a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-gifted-charts", - "version": "1.4.42", + "version": "1.4.43", "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.", "main": "dist/index.js", "files": [ @@ -25,7 +25,7 @@ "registry": "https://registry.npmjs.org/" }, "dependencies": { - "gifted-charts-core": "0.1.42" + "gifted-charts-core": "0.1.43" }, "devDependencies": { "@babel/cli": "^7.24.8", @@ -50,10 +50,10 @@ "typescript": "^5.5.4" }, "peerDependencies": { + "expo-linear-gradient": "*", "react": "*", "react-native": "*", "react-native-linear-gradient": "*", - "expo-linear-gradient": "*", "react-native-svg": "*" }, "peerDependenciesMeta": { diff --git a/release-notes/release-notes.md b/release-notes/release-notes.md index 2141f4ed..095aa335 100644 --- a/release-notes/release-notes.md +++ b/release-notes/release-notes.md @@ -1,3 +1,14 @@ +## 🎉 1.4.43 + +1. Added `onLeftPress` and `onRightPress` props to Population charts. See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/discussions/855 +2. Fix BarChart crash when maxValue is 0. Thanks to [sakisdog](https://github.com/sakisdog) for the PR- https://github.com/Abhinandan-Kushwaha/gifted-charts-core/pull/55 + +--- + +--- + +--- + # 🎉 1.4.42 ## ✨ Features added- diff --git a/src/PopulationPyramid/index.tsx b/src/PopulationPyramid/index.tsx index 500cfea1..d2229678 100644 --- a/src/PopulationPyramid/index.tsx +++ b/src/PopulationPyramid/index.tsx @@ -319,6 +319,7 @@ export const PopulationPyramid = (props: PopulationPyramidPropsType) => { fill={item.leftBarColor ?? leftBarColor} stroke={item.leftBarBorderColor ?? leftBarBorderColor} strokeWidth={leftBorderWidth} + onPress={() => props.onLeftPress?.(item, index)} /> @@ -384,6 +385,7 @@ export const PopulationPyramid = (props: PopulationPyramidPropsType) => { fill={item.rightBarColor ?? rightBarColor} stroke={item.rightBarBorderColor ?? rightBarBorderColor} strokeWidth={rightBorderWidth} + onPress={() => props.onRightPress?.(item, index)} />