expo / expo-pixi

Tools for using pixi.js in Expo
MIT License
304 stars 119 forks source link

Not compatible with Expo sdk 39 #143

Closed msamirma closed 3 years ago

msamirma commented 3 years ago

After upgrade to expo sdk 39, i got multiple warnings. expo-asset-utils@1.2.0" has incorrect peer dependency "expo-asset@~4.0.0" expo-asset-utils@1.2.0" has incorrect peer dependency "expo-file-system@~4.0.0" expo-asset-utils@1.2.0" has incorrect peer dependency "expo-font@~4.0.0"

And some functions like const sprite = await PIXI.Sprite.fromExpoAsync( 'http://i.imgur.com/uwrbErh.png', ); app.stage.addChild(sprite); not working anymore. @EvanBacon help would be appreciated

gregfenton commented 3 years ago

I am running into problems with my project as well. Things using ExpoPixi.Sketch and sketch.takeScreenshotAsync() worked fine on expo v38 for a "signature capture" solution. With the upgrade to expo v39, I am getting this in my console:

EXGL: gl.pixelStorei() doesn't support this parameter yet!

Though I don't know that this is the root of my issue. (My app keeps failing trying to upload the byte stream coming back from takeScreenshotAsync(). Still investigating . . .)

During my investigation, I decided to try the examples from this proect (expo-pixi/examples).

To get them running (successfully!!!) in my iOS simulator, here's what I did:

  1. Run git clone https://github.com/expo/expo-pixi.git
  2. Run cd expo-pixi/examples/sketch
  3. Run yarn install <<--- there will be errors
  4. Edit package.json changing the entry for "expo-pixi" to:
    • "expo-pixi": "^1.2.0",
  5. Run expo upgrade <<--- I answered "yes" to all questions (though I skipped upgrading client on emulators)
  6. Run expo install expo-gl <<-- without this, expo start will fail complaining about expo-gl not being available
  7. Run expo start

And the app runs in the iOS simulator just fine, with the exception of the warning message in the console mentioned above.

Still investigating the uploading the byte-stream issue...

gregfenton commented 3 years ago

Follow up: my code is back to working. Was not (necessarily?) an issue with Expo-Pixi. It seems that the behaviour of fetch() has changed with my upgrade to expo v39.

I was doing:

  const {uri} = await sketch.takeSnapshotAsync({format: 'png', compress: 0.1});
  let response = await fetch(uri);
  let blob = await response.blob();
  uploadToFirebaseStorage(blob, "my-new-file-name.png");

that worked under expo v38, but with v39 it was failing with a network error from the fetch() line.

With v39, this is the code that is now working:

  const {uri} = await sketch.takeSnapshotAsync({format: 'png', compress: 0.1});
  let str = await FileSystem.readAsStringAsync(uri, {encoding: 'base64'});
  str = 'data:image/png;base64,' + str;
  let response = await fetch(uri);
  let blob = await response.blob();
  uploadToFirebaseStorage(blob, "my-new-file-name.png");

(If anyone can recommend a clearer approach to the above, much appreciate in advance!!)

So, from my POV, there was a behaviour change between v38 and v39 but expo-pixi wasn't to blame in my use case and it is now working again!

quentez commented 3 years ago

Same here. Getting this on Expo 39:

EXGL: gl.pixelStorei() doesn't support this parameter yet!
gregfenton commented 3 years ago

Same here. Getting this on Expo 39:

I still get that warning, but it doesn't seem to impede capabilities that I can tell.

msamirma commented 3 years ago

I will close this issue as these warning not cause issue when running expo-pixi