1

I'm new to react-native and want to use victory-native in my create-react-native-app. I came across Victory charts after googling for some time, but unfortunately, I'm not able to use it. This is the error screenshot And Android Error log Screenshot

And this my code:

import React from 'react';  
import { StyleSheet, View } from 'react-native';  
import { VictoryBar, VictoryChart } from 'victory-native';  

const styles = StyleSheet.create({  
  container: {  
    flex: 1,  
  },  
});  

const data = [
    { quarter: 1, earnings: 13000 },
    { quarter: 2, earnings: 16500 },
    { quarter: 3, earnings: 14250 },
    { quarter: 4, earnings: 19000 },
];

const AppChart = () => {
  return (
    <View style={styles.container}>
      <VictoryChart>
        <VictoryBar
          style={{
            data: { fill: 'blue' },
          }}
          data={data}
          x="quarter"
          y="earnings"
        />
      </VictoryChart>
    </View>
  );
};

export default AppChart;
Community
  • 1
  • 1
Avijit Dutta
  • 3,651
  • 3
  • 13
  • 16

0 Answers0