【发布时间】:2020-02-07 19:25:49
【问题描述】:
我尝试使用 Chart Kit 库运行基本的 React Native 应用程序,但出现此错误: CLICK FOR IMAGE: Exception thrown while executing UI block: __NSCFNumber firstObject: unrecognized selector sent to instance 0xa3576e305374b97e
有人知道怎么解决吗?
这是我的代码:
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { LineChart, Grid } from 'react-native-svg-charts';
class LineChartExample extends React.PureComponent {
render() {
const data = [50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80];
return (
<LineChart
style={{ height: 200 }}
data={data}
svg={{ stroke: 'rgb(134, 65, 244)' }}
contentInset={{ top: 20, bottom: 20 }}
>
<Grid />
</LineChart>
)
}
}
export default LineChartExample;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
【问题讨论】:
标签: reactjs react-native react-native-chart-kit