react-native-gifted-charts icon indicating copy to clipboard operation
react-native-gifted-charts copied to clipboard

Focused Donut not work

Open Angros23 opened this issue 2 years ago • 2 comments

When change the prop focused from true to false in the data, not chance in Donut focused.

Angros23 avatar Feb 02 '23 22:02 Angros23

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>
            );
          }}
        />
)

anniewey avatar Mar 09 '23 09:03 anniewey

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?

agonselimi avatar Jan 04 '24 14:01 agonselimi