pixijs / pixi-react

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

Bug: issues with interactivity if you never import pixi.js #463

Closed johnfn closed 3 months ago

johnfn commented 7 months ago

Current Behavior

If you try to use interactivity-related stuff in pixi-react, you'll get a typescript error. For instance, trying to set interactive={true} or eventMode="static" doesn't work.

Expected Behavior

It should work :)

Steps to Reproduce

Create a new project with pixi-react. DO NOT EVER IMPORT pixi.js.

Environment

"dependencies": { "@pixi/react": "^7.1.1", "next": "14.0.3", "pixi.js": "^7.3.2", "react": "^18", "react-dom": "^18" },

Possible Solution

There is a straightforward but non-obvious workaround to this problem: add an import to pixi.js anywhere in your project.

I think this is because pixi.js extends some shared mixin interfaces.

Additional Information

No response

Yuma-Satake commented 7 months ago

@johnfn import '@pixi/events'; Inserting an import statement prevents errors from occurring in static analysis. However, even if interactivity is enabled, click events, etc. are not enabled. I'm having the same problem.