coinjar / react-native-wagmi-charts

A sweet & simple chart library for React Native that will make us feel like We're All Gonna Make It.
MIT License
575 stars 114 forks source link

Line chart hooks not working #74

Open xamsuka opened 2 years ago

xamsuka commented 2 years ago

Line chart hooks not working (LineChart.useChart, LineChart.usePrice). Hook works once, then the data ceases to be updated. If you use components instead of hooks, then everything works. I tried downgrading the library.

"react-native-wagmi-charts": "^2.1.0",
"react-native": "0.67.1",
"react-native-gesture-handler": "^2.2.0",
maakle commented 2 years ago

I have the same issue. The hook basically works at the beginning when the component renders. It logs this:

LOG {"value": ""}

And then nothing is updated.

joey-harward commented 2 years ago

Any update on this? These hooks don't seem to work. Can't seem to find a good example either. I just need a hook where I can get the current chart data or price. Thanks!

nhuesmann commented 1 year ago

As of 9/27/22, none of the hooks work. This would be a very helpful feature, and it's advertised in the docs as being usable. Would the author/maintainers be able to take a look? My package versions:

"react-native": "0.69.4",
"react-native-gesture-handler": "~2.5.0",
"react-native-wagmi-charts": "~2.1.0",
amradawi commented 1 year ago

any update on this guys ?

dchhetri commented 1 year ago

@mxs Same issue here, hooks are not refreshing with data is changed. Any fix?

arancauchi commented 1 year ago

Hi guys, looking into this one, it appears that the hooks are updating just fine on my end. Since these are shared values, they don't automatically trigger updates to react components.

If you run this hook for example

  useAnimatedReaction(() => price.formatted.value,
    () => {
      console.log(price.formatted.value);
    });

you will see the values are indeed updating.

To confirm as well, are your components lower in the hierarchy than the relevant chart provider, eg. <LineChart.Provider>? The hooks need to access the relevant contexts for their data.