nihgwu / react-native-pie

Pie chart for React Native
MIT License
107 stars 25 forks source link

Since v0.2.0: "child keys must be unique" warning #3

Closed sirilicious closed 7 years ago

sirilicious commented 7 years ago

Since the new version 0.2.0, i receive following error warning:

screen shot 2017-07-12 at 16 22 27

I bet on the modified key={idx} property in the Shape element.

nihgwu commented 7 years ago

I'm calculate the key key={${startAngle}-${arcAngle}} to avoid using index as key I think you just pass series=[x, 0, 0] to the component, can you provide you related code?

sirilicious commented 7 years ago

I'm using the pie as a gauge for percentage between two choices:

getPiePercentages(){
   const pA = this.getPercentage(0)/2; // getPercentage(0) returns e.g. 25
   const pB = this.getPercentage(1)/2; // getPercentage(1) returns e.g. 75
   return [pA, pB, pB, pA];
}

Which is used as following: <Pie series={this.getPiePercentages()} ... />

nihgwu commented 7 years ago

I'll release a new version in next week

nihgwu commented 7 years ago

resolved by https://github.com/nihgwu/react-native-pie/commit/86adf51339854ef3dc50df8cef6d12afb9df7b82