Search code examples
apireact-nativereact-native-chart-kit

react-native-chart-kit error while updating property "d" of a view managed by RNSVGPath:


I am using react-native-chart-kit pie chart.

In the data array, instead of writing a number in the population, I am writing “this.state.data” as shown below since I am getting the numbers from an API.

const pieData1 = [
  {
    name: ': East',
    population: this.state.data,
    color: '#00664f',
    legendFontColor: 'black',
    legendFontSize: 12,
  },

]

But I get the error "error while updating property "d" of a view managed by RNSVGPath:". Any idea how to solve it please?


Solution

  • Just typecast your state to Integer using parseInt

    const pieData1 = [
      {
        name: ': East',
        population: parseInt(this.state.data), ////
        color: '#00664f',
        legendFontColor: 'black',
        legendFontSize: 12,
      },