我正在使用 React Native Expo(36.0.0)。我正在为我的项目开发仪表板屏幕。所以,我只想在仪表板屏幕中显示一些饼图。我已经尝试了许多用于各种图表的库。没有什么对我有用。最后我在 youtube 视频的帮助下使用了react-native-pie。它仍然向我显示同样的错误。
我是 React Native 的新手。
谢谢!
import React, { Component } from 'react';
import { View, Text, ScrollView, StyleSheet, TouchableOpacity, ActivityIndicator, Dimensions } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import Pie from 'react-native-pie';
class HomeScreen extends Component
{
constructor(props)
{
super(props);
}
render()
{
return(
<ScrollView>
<View style={styles.homeContainer}>
<View style={{paddingVertical:15, flexDirection:'row', width:350, justifyContent:'center'}}>
<Pie
radius={80}
sections={[
{
percentage:10,
color:'red'
},
{
percentage:30,
color:'green'
},
{
percentage:60,
color:'orange'
}
]}
/>
</View>
</View>
</ScrollView>
)
} …Run Code Online (Sandbox Code Playgroud) react-native ×1