Flipboard / react-canvas

High performance <canvas> rendering for React components
BSD 3-Clause "New" or "Revised" License
13.18k stars 919 forks source link

[FORK] react-canvas with added support for React 16, React 17 and React 18 #181

Open antoninkriz opened 1 year ago

antoninkriz commented 1 year ago

Link: antoninkriz/react-canvas

Hello, sadly this repository seems very dead, so I would like to introduce you to my fork.

At @qntln we use our own fork which I had the honor to upgrade to support React 18. While experimenting with our current version I managed to upgrade react-canvas to support all newer versions of React.

Changes and support

Currently my fork supports (please check my fork's README.md for any updates):

and also introduces Least Recently Used Cache (LRU Cache) (written by @darkyen darkyen/react-canvas/LRUCache) that's currently missing from some newer forks like qntln/react-canvas, which supports React 16.8.8 (and my fork might get merged there in the future).

At the time of writing I haven't had a chance to deeply test all the changes, although the code runs OK so far, so please, if you encounter any issues please also create one in my repository!

Usage

As there isn't a npm package yet (if there'll be an interest I'll create one) you can install these versions be editing package.json like this:

{
  ...
  "packages": {
    ...
    "react-canvas": "https://github.com/antoninkriz/react-canvas.git#BRANCH_NAME",
    ...
  },
  ...
}

where you should specify BRANCH_NAME according to README.md in the fork's repository.

MichaelBonnet commented 1 year ago

Hi Antonin,

Would you happen to have any suggestions for newly installing your fork of react-canvas into a project? Downloading just by adding that line under packages/dependencies doesn't seem to work, and attempting to npm install react-canvas then change later doesn't work because I'm on react 18.2.

antoninkriz commented 1 year ago

@MichaelBonnet Try npm install 'https://github.com/antoninkriz/react-canvas/tarball/BRANCH_NAME' instead.

If it doesn't work for you please create an issue in the antoninkriz/react-canvas repository. For some reason Issues weren't enabled in there but it should be fixed now. :pray: