margelo / react-native-graph

📈 Beautiful, high-performance Graphs and Charts for React Native built with Skia
https://margelo.io
MIT License
2.04k stars 115 forks source link

Support in Expo SDK 48 #67

Open rizahassan opened 1 year ago

rizahassan commented 1 year ago

Hi everyone,

react-native-skia is supported in Expo starting Expo SDK 46. I am trying to get react-native-graph working in my Expo app (Expo SDK 48) but am not successful at that. Can someone create a Snack example to get it working?

Thanks!

colinfran commented 1 year ago

im running into the same issue i think. Running expo 48.0.5. I am able to get example code to run visually, BUT i am not able to move the selectionDot.

is this the same issue you are dealing with?

rizahassan commented 1 year ago

@colinfran I can't get my project to show the graph visually. Can you share the example code with me?

colinfran commented 1 year ago

https://github.com/colinfran/react-native-crypto-wallet

colinfran commented 1 year ago

I was able to get everything to work, including selectionDot. See my above app for an example of running this package running with expo 48.0.5.

ArtKullashi commented 1 year ago

Make sure your points have different date values, otherwise the graph doesn't render. Example: const dataPoints = [ {value: 10, date: new Date(1675904400000)}, {value: 20, date: new Date(1675990800000)} ]

Joelis57 commented 1 year ago

@colinfran How exactly did you solve the SelectionDot not moving? As though your included sample is very helpful, it's also large and it's not exactly clear what specifically solves the issue.

ArtKullashi commented 1 year ago

@Joelis57 Try wrapping your entire view where your graph is with a GestureHandlerRootView imported from react-native-gesture-handler

colinfran commented 1 year ago

@Joelis57 honestly this package gave me a headache. Although it worked, i was having so many issues with it.

if you want an almost issue free experience, use https://github.com/coinjar/react-native-wagmi-charts, it’s what I’m using now. Its documentation is amazingly helpful.

Im using it exactly how the example in this repo.

Joelis57 commented 1 year ago

@ArtKullashi Thanks for this, completely missed this! But even after adding it, it did not solve the issue.

@colinfran Thank you for the suggestion, probably will try to switch if I'm not able to solve my current issues, but I'd still prefer to use skia if possible. Thanks again for a viable alternative!

ghasemikasra39 commented 1 year ago

In my case I have a weird issue with these versions:

    "@shopify/react-native-skia": "0.1.182",
    "expo": "~48.0.9",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.6",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-graph": "^1.0.1",
    "react-native-reanimated": "~2.14.4",

I am using the exact same data in the example app and my own app:

export const POINTS = [
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 0),
    value: 1,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 1),
    value: 5,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 2),
    value: 10,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 3),
    value: 3,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 4),
    value: 10,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 5),
    value: 6,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 6),
    value: 0,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 7),
    value: 35,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 8),
    value: 19,
  },
  {
    date: new Date(new Date(2000, 0, 1).getTime() + 1000 * 60 * 60 * 24 * 9),
    value: 0,
  },
]

Below you can see the rendering in the example app and my app:

Example App My App (The plot is not correct)
Screenshot 2023-04-06 at 14 55 34 Screenshot 2023-04-06 at 14 55 19

I don't know which version of react-native-graph the example uses. But in my case (you can see the versions above), it renders wrong!

jetaggart commented 9 months ago

I also can only get the graph to render but gestures are not working on expo 49

gabimoncha commented 7 months ago

Package works with expo 50. Just remember to install everything using npx expo install These are the versions the time this comment was posted:

    "@shopify/react-native-skia": "0.1.221",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-graph": "^1.0.2",
    "react-native-reanimated": "~3.6.0",