pixijs / pixi-react

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

Error creating custom component #488

Closed mrboots123 closed 6 months ago

mrboots123 commented 6 months ago

Current Behavior

Unable to create basic example using docs, rendering a custom component causes an error.

Screenshot 2024-05-18 at 3 21 19 PM

Expected Behavior

Renders a graphics correctly instead of erroring out

Steps to Reproduce

`import {Stage,PixiComponent} from '@pixi/react';

import '@pixi/particle-emitter' import * as PIXI from 'pixi.js';

const Circle = PixiComponent('Circle', { create: props => new PIXI.Graphics(),

applyProps: (instance, oldProps, newProps) => {
    instance.clear();
    instance.lineStyle(4, 0xffd700, 1);

    instance.beginFill(0x000000, 0); 
    instance.drawRoundedRect(100, 100, 50, 50, 5);
    instance.endFill(); 
}

});

const App = () => { return ( <Stage width={500} height={500} options={{ autoDensity: true, backgroundColor: 0x012b30 }}>

  </Stage>

); };

export default App;`

Environment

  • @pixi/react version: e.g. 7.1.2
  • pixi.js version: e.g. 8.0.2
  • React version: e.g. 18.0.0
  • ReactDOM version: e.g. 18.0.0
  • Browser & Version: e.g. Chrome 108
  • OS & Version: e.g. Ubuntu 22.04
  • Running Example: e.g. https://pixiplayground.com/

Possible Solution

No response

Additional Information

No response

mrboots123 commented 6 months ago

closing this issue, solution was version 8 was not supported, downgrading to 7 makes it work