pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.33k stars 177 forks source link

Error with react 18 #337

Closed plantain-00 closed 1 year ago

plantain-00 commented 2 years ago

Description

seems related: https://github.com/inlet/react-pixi/issues/306

react-dom.development.js:22665 Uncaught Error: Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.
    at findCurrentUnmaskedContext (react-pixi.es-dev.js:3904:15)
    at getContextForSubtree (react-pixi.es-dev.js:20484:23)
    at Object.updateContainer (react-pixi.es-dev.js:20603:17)
    at Stage.componentDidMount (react-pixi.es-dev.js:22880:17)

Steps to reproduce

  1. Use the code from https://reactpixi.org/components/graphics
  2. The error above appears.

Additional info

jdlee022 commented 1 year ago

Is there a solution for this?

plantain-00 commented 1 year ago

Is there a solution for this?

I couldn't find any solution in the past several months, so I migrated to raw WebGL instead.

saitonakamura commented 1 year ago

@plantain-00 @jdlee022 You can use @saitonakamura/react-pixi@17.0.0-beta-5, it has support for react 18 and we've being using it in production for a month

baseten commented 1 year ago

This should be fixed now in v7.0.0-alpha.0, please install from @pixi/react-pixi