Skip to content

Commit

Permalink
Update index.js (#430)
Browse files Browse the repository at this point in the history
Fix support for canvas renderer
  • Loading branch information
salojoo authored May 4, 2023
1 parent bc6ce78 commit 28fe89b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/react/src/stage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,12 @@ class Stage extends React.Component

if (process.env.NODE_ENV === 'development')
{
// workaround for React 18 Strict Mode unmount causing canvas
// context to be lost
this.app.renderer.context.extensions.loseContext = null;
// workaround for React 18 Strict Mode unmount causing
// webgl canvas context to be lost
if (this.app.renderer.context?.extensions)
{
this.app.renderer.context.extensions.loseContext = null;
}
}

this.app.ticker.autoStart = false;
Expand Down

0 comments on commit 28fe89b

Please sign in to comment.