pixi-react icon indicating copy to clipboard operation
pixi-react copied to clipboard

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

Open johnfn opened this issue 2 years ago • 1 comments

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" },

  • Browser & Version: Latest Chrome
  • OS & Version: MacOS latest

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

johnfn avatar Nov 22 '23 23:11 johnfn

@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.

Yuma-Satake avatar Nov 30 '23 06:11 Yuma-Satake