indiespirit / react-native-chart-kit

📊React Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)
https://expo.io/@indiespirit/react-native-chart-kit
MIT License
2.84k stars 659 forks source link

Bar Chart Not working with typescritp #546

Open abdullahrehan430 opened 3 years ago

abdullahrehan430 commented 3 years ago

I am trying to shifting my code from js to tsx in react-native bar chart working in js perfectly but when i change my project to .tsx i throw the error:

No overload matches this call. Overload 1 of 2, '(props: (AbstractChartProps & BarChartProps) | Readonly<AbstractChartProps & BarChartProps>): BarChart', gave the following error. Type '{ data: { labels: string[]; datasets: { data: number[]; }[]; }; width: number; height: number; chartConfig: { backgroundGradientFrom: string; fillShadowGradient: string; decimalPlaces: number; fillShadowGradientOpacity: number; ... 6 more ...; propsForBackgroundLines: { ...; }; }; withHorizontalLabels: true; vertica...' is missing the following properties from type 'Readonly<AbstractChartProps & BarChartProps>': yAxisLabel, yAxisSuffix Overload 2 of 2, '(props: AbstractChartProps & BarChartProps, context: any): BarChart', gave the following error. Type '{ data: { labels: string[]; datasets: { data: number[]; }[]; }; width: number; height: number

These are my dependices "dependencies": { "@react-navigation/bottom-tabs": "^6.0.4", "@react-navigation/drawer": "^6.1.3", "@react-navigation/native": "^6.0.2", "@react-navigation/native-stack": "^6.0.5", "react": "17.0.1", "react-native": "0.64.2", "react-native-chart-kit": "^6.11.0", "react-native-elements": "^3.4.2", "react-native-safe-area-context": "^3.3.0", "react-native-screens": "^3.5.0", "react-native-svg": "^12.1.1", "react-native-svg-transformer": "^0.14.3" }, "devDependencies": { "@babel/core": "7.15.0", "@babel/runtime": "7.15.3", "@react-native-community/eslint-config": "2.0.0", "babel-jest": "26.6.3", "eslint": "7.14.0", "jest": "26.6.3", "metro-react-native-babel-preset": "0.64.0", "react-test-renderer": "17.0.1" }, "jest": { "preset": "react-native" } }

tscong.json { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "isolatedModules": true, "jsx": "react", "lib": ["es6", "es2017"], "moduleResolution": "node", "noEmit": true, "strict": true, "target": "esnext", "skipLibCheck": true }, "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"] }

gabrielbuzziv commented 2 years ago

up

LamQuyet commented 2 years ago

I created my project with the template of typescript and this lib is working

emsuvith commented 3 months ago

create project in typescript it works