react-native-gcanvas icon indicating copy to clipboard operation
react-native-gcanvas copied to clipboard

Any plans or possibilities to use JSI?

Open olosegres opened this issue 2 years ago • 4 comments

Hello, thanks for your work, appreciate it :)

Your tool opens the opportunity to use many libraries and algorithms from web development.

But animation rendering requires JS calculation and some things cannot work normally due to the calculation lags of each frame. JSI can solve this problem.

Have you think about the opportunity to use it with JSI?

I seems like existing API of react-native-gcanvas api will fit good to the approach that used in react-native-reanimated2 or react-native-skia.

olosegres avatar Dec 15 '22 18:12 olosegres

Recently (at least a year) I have no time to rewrite everything to JSI, if you desire JSI performance, maybe you can try expo-gl@^11.0.0.

react-native-skia just 2d, but react-native-gcanva support 2d and 3d, so react-native-skia is not considered.

And which api is fit good between react-native-gcanvas and react-native-reanimated2, for example?

flyskywhy avatar Dec 16 '22 00:12 flyskywhy

I meant js woklets, or a woklet hook, it seems the react-native-gcanvas js API can be left the same as it is now.

I don't know about the difficulty of translating to JSI, is it very labor intensive?

p.s. I can't use those libraries, because I have a lot of business logic tied to the canvas API

olosegres avatar Dec 19 '22 11:12 olosegres

Do you mean lot of business logic tied to the canvas API can be run in worklet e.g. https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/worklets/ ? Have you tested it or verified it?

With some blog about JSI I've read, translating to JSI need re-write every code so it is very labor intensive.

flyskywhy avatar Dec 20 '22 00:12 flyskywhy

Do you mean lot of business logic tied to the canvas API can be run in worklet e.g

I hope that one day it will be possible :) No, I didn't try it. I think It should require some patches on native side, but I'm not so deep into the wilds of react-native.

olosegres avatar Dec 24 '22 07:12 olosegres