expo/expo-phaser

[SUPPORT] TypeError in game.js when setting global.document.readyState

arvinsingla opened this issue · 0 comments

Please let me know if this should be posted in the Expo forums instead of here. When following the basic example in the README I get the following error

TypeError: Cannot assign to read only property 'readyState' of object '#'

Module.game
node_modules/expo-phaser/lib/game.js:12
   9 |   onRender,
  10 | }): Phaser.Game {
  11 |   global.__context = context;
> 12 |   global.document.readyState = 'complete';
  13 |   const game = new Phaser.Game(
  14 |     width || context.drawingBufferWidth,
  15 |     height || context.drawingBufferHeight,

If I comment out the line in question the scene seems to load correctly. Is there something I'm doing wrong in my setup?

Here is an example of my app which is extremely simple.

import React from 'react';
import { GLView } from 'expo-gl';
import ExpoPhaser from "expo-phaser";

export default function App() {
  return (
    <GLView
      style={{ flex: 1 }}
      onContextCreate={context => startGame({ context })}
    />
  );
}

function startGame({ context }) {
  const game = ExpoPhaser.game({ context });

  game.state.add("Playable", {
    create: function() {
      game.stage.backgroundColor = "#4488AA";
    }
  });

  game.state.start("Playable");
}

Versions

Node: v12.15.0
Expo: v3.16.1