【发布时间】:2020-01-20 12:59:19
【问题描述】:
我是 react-native 开发的新手。 每当我尝试使用任何框架时,都会出现错误
必须在 Text 内呈现不变的违规文本字符串 组件
我尝试了两个库 react-number-format 和 pichart react-minimal-pie-chart
我知道已经问了很多问题,我尝试了所有问题,但都是关于语法问题,所以我不得不问,因为我认为这与语法无关,因为代码中没有任何空格。
代码如下:
import React, { Component } from 'react';
import { View } from 'react-native';
import NumberFormat from "react-number-format"
import PieChart from react-minimal-pie-chart
export default class Calculation extends Component {
constructor(props) {
super(props);
this.state = {
};
render() {
return (
<View>
<View style={{ backgroundColor: "lightgray", height: 1, marginHorizontal: 5 }} />
<NumberFormat displayType="text" thousandSeparator={true} thousandsGroupStyle="lakh" prefix={'₹'} value={123456789} />
<PieChart
data={[
{ title: 'One', value: 10, color: '#E38627' },
{ title: 'Two', value: 15, color: '#C13C37' },
{ title: 'Three', value: 20, color: '#6A2135' },
]}
/>
</View>
);
}
}
react-native 版本是"0.60.5"。
我附上了截图供参考。
提前致谢!!!
【问题讨论】:
-
想知道.. 库
react-minimal-pie-chartreact-native 兼容吗? -
您使用的是 expo 还是 create-react-native-app ?另外,您能否发布整个组件的代码以及您在哪里使用它?
-
@AtinSingh 我正在使用 creat-react-native-app。我正在更新代码。
标签: ios reactjs react-native npm pie-chart