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

expo-pixi blank screen and error

Open ShukantPal opened this issue 4 years ago • 1 comments

I am trying to use PixiJS and I can't get anything to work. This is my code:

function init(context: WebGLRenderingContext) {
  let app = new PIXI.Application({
    context,
    background: 0xfeabcd,
    width: 100,
    height: 100,
  });
  let g = new PIXI.Graphics();
  g.beginFill(0);
  g.drawCircle(100, 50, 50);
  g.endFill();
  app.stage.addChild(g);
}

const SurakartaBoard: () => React$Node = () => (
  <GLView
    onContextCreate={(context: WebGLRenderingContext) => {
      init(context);
    }}
  />
);

I get the following error message:

Require cycle: node_modules/pixi.js/lib/core/index.js -> node_modules/pixi.js/lib/core/textures/Spritesheet.js -> node_modules/pixi.js/lib/core/index.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
(node:21538) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added to [HasteMap]. Use emitter.setMaxListeners() to increase limit
 LOG  BugReporting extraData: {"AppRegistry.runApplication1": "Running \"Surakarta\" with {\"rootTag\":1,\"initialProps\":{}}"}
 LOG  BugReporting extraData: {"AppRegistry.runApplication1": "Running \"Surakarta\" with {\"rootTag\":1,\"initialProps\":{}}"}
 LOG  BugReporting extraData: {"AppRegistry.runApplication1": "Running \"Surakarta\" with {\"rootTag\":1,\"initialProps\":{}}"}
# ... like a 100 more times

Do you have an idea what the problem is?

Update

I found that importing PIXI from expo-pixi is the the culprit (even if I don't use it in my component tree). For example,

import {PIXI} from 'expo-pixi';

const App: () => React$Node = () => {
  return (
    <SafeAreaView style={styles.container}>
      <Text>Safe Hello World!</Text>
    </SafeAreaView>
  );
};

On running npx react-native run-ios, this would cause a white, blank screen. I am testing on the iPhone 11 Pro Max emulator, iOS 13.3. My computer also heats up when running this code. Removing the import solves the issue.

ShukantPal avatar Dec 28 '19 20:12 ShukantPal

I think upgrading to pixi.js 5 will solve this problem because they compiled everything into one module.

ShukantPal avatar Jan 01 '20 15:01 ShukantPal