highcharts / highcharts/highcharts-react-native

Is there anyway to use this library in a project which is initialized by Expo & using Typescript template?

Open
#136 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
105
Forks
79
PR merge metrics
No merged PRs in 30d

Description

I know this library is deprecated but hope someone has also met the issue.
I tried following the instruction but it doesn't work.

My steps:
- Install package by yarn
- Create file metro.config.js
- Install react-native-webview by yarn
- Put some //@ts-ignore in code for ignore type checking
- Try with the example code in a component
```js
import React, { useEffect, useState } from "react";
import { View, StyleSheet } from "react-native";
// @ts-ignore
import HighchartsReactNative from "@highcharts/highcharts-react-native";

const Chart: React.FC = () => {
const [chartOptions, setChartOptions] = useState();

useEffect(() => {
let intervalId: NodeJS.Timer;
const chartOptionsTest = {
chart: {
events: {
load: function () {
// @ts-ignore
// set up the updating of the chart each second
const series = this.series[0];
intervalId = setInterval(function () {
const y = Math.random();
series.addPoint(y, true, true);
}, 1000);
}
}
},
series: [{
data: [1, 2, 3]
}]
}
setChartOptions(chartOptionsTest);

return () => {
if (intervalId) {
clearInterval(intervalId);
}
}
}, [])

return (



)
}

const styles = StyleSheet.create({
container: {
backgroundColor: '#fff',
justifyContent: 'center',
flex: 1
}
});

export default Chart;

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.