react-native-gifted-charts
react-native-gifted-charts copied to clipboard
Focused Donut not work
When change the prop focused from true to false in the data, not chance in Donut focused.
Had the same problem, also happened when setting state from [] to [{..}]. Can reproduce with simple example below. The pie is showing but the focused section isn't reflecting.
const [data, setData] = useState<any>([]); //if assign newData here, will reflect the focused section
useEffect(() => {
const newData = [
{
"color": "#AED137",
"focused": true,
"gradientCenterColor": "#E6F1C2",
"title": "Amazing",
"value": 3
},
{
"color": "#1EB8EB",
"gradientCenterColor": "#BBE9F9",
"title": "Great",
"value": 3
},
];
setData(newData);
}, []);
return (
<PieChart
data={data}
donut
showGradient
sectionAutoFocus
radius={90}
innerRadius={60}
innerCircleColor={Colour.DarkGrey}
centerLabelComponent={() => {
return (
<Text style={styles.textPieValue}>
{`${data[0]?.value}%`}
</Text>
);
}}
/>
)
I have version "^1.3.28", and on Android, the focusOnPress is not working correctly, it is not focusing when I'm pressing it but rarely, and glitchy, but that's not my main concern. My main concern is that when I'm using donut, the press gesture does not work on all of the chart sections, but on some random places in them. Can the library owner take a look at that?