when I tried to run the following example on Expo
import React from 'react'
import { LineChart,} from "react-native-chart-kit";
import {View,Text,Dimensions} from 'react-native'
class AgeChart extends React.PureComponent {
render() {
return (
<View>
<Text>Bezier Line Chart</Text>
<LineChart
data={{
labels: ["January", "February", "March", "April", "May", "June"],
datasets: [
{
data: [
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100
]
}
]
}}
width={Dimensions.get("window").width} // from react-native
height={220}
yAxisLabel="$"
yAxisSuffix="k"
yAxisInterval={1} // optional, defaults to 1
chartConfig={{
backgroundColor: "#e26a00",
backgroundGradientFrom: "#fb8c00",
backgroundGradientTo: "#ffa726",
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
style: {
borderRadius: 16
},
propsForDots: {
r: "6",
strokeWidth: "2",
stroke: "#ffa726"
}
}}
bezier
style={{
marginVertical: 8,
borderRadius: 16
}}
/>
</View>
)
}
}
export default AgeChart
I keep getting this error
_Exception thrown while executing UI block:- [__NSCFNumber firstObject]: unrecognised selector sent to instance 0xb8de0cb5768fff3_ for IOS
and for Android
_Error while updating property 'stroke' of a view managed by RNSVGLine
null
java.lang.Double cannot be cast to java.lang.String_
Did you try to install react-native-svg?
@JohnBerd i did install react-native-svg and react-native-chart-kit but still nothing is working
okay i solve it by downgrade react-native-svg to 9.13.3
In case it still does not work and you are using expo. Do the following :
expo install react-native-svg and then expo r -c
Most helpful comment
okay i solve it by downgrade react-native-svg to 9.13.3