I have been working with javascript, nodejs, and react for a while and decided to try react native. However, when I tried to use a pie chart with either react-native-pie-chart or react-native-pie, I recieved an error (the same one both times). The error I had was:
(0 , n.requireNativeComponent) is not a function
Evaluating @react-native-community/art.js
Evaluating react-native-pie-chart.jse here
This is pretty confusing to me, since the module seems to work for most other people.
The code I had was:
import * as React from 'react';
import { Text, View, StyleSheet, Image } from 'react-native';
import { Card } from 'react-native-paper';
import PieChart from 'react-native-pie-chart';
export default function Stats({ data }) {
const widthAndHeight = 250
const series = [123, 321, 123, 789, 537]
const sliceColor = ['#F44336','#2196F3','#FFEB3B', '#4CAF50', '#FF9800']
return (
<View style={styles.container}>
<PieChart
widthAndHeight={widthAndHeight}
series={series}
sliceColor={sliceColor}
doughnut={true}
coverRadius={0.45}
coverFill={'#FFF'}
/>
</View>
)
export default Stats
Help with fixing this would be appreciated. Thanks! :)