expo / expo-2d-context

A pure-js implementation of the W3C's Canvas-2D Context API that can be run on either Expo Graphics or WebGL
111 stars 7 forks source link

[expo-2d-context][SDK 45][iOS+Android] Crash when running example with latest Expo GO #40

Open sandlands opened 2 years ago

sandlands commented 2 years ago

Summary I have just installed the latest version of Expo GO (2.25.1, "added support for SDK 46"). My project is using SDK 45. That results in a crash when I try to use Expo2DContext (on both iOS and Android). I have the latest version of expo-cli. When I upgrade to SDK 46, the issue is solved. Since SDK 46 has just been released, it should still be supposed to work with SDK 45, right?

Phones

Managed or bare workflow? managed

What platform(s) does this occur on? iOS + Android

SDK Version (managed workflow only) 45

Environment expo-env-info 1.0.5 environment info: System: OS: macOS 11.6.5 Shell: 5.0.16 - /usr/local/bin/bash Binaries: Node: 16.13.1 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 8.3.0 - /usr/local/bin/npm Watchman: 2022.01.03.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: Android NDK: 23.1.7779620 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild npmPackages: expo: ~45.0.0 => 45.0.8 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-web: 0.17.7 => 0.17.7 npmGlobalPackages: eas-cli: 0.56.0 expo-cli: 6.0.1 Expo Workflow: managed

Reproducible demo

expo init [choose blank (Typescript)]
expo install expo-gl expo-2d-context

Replace App.tsx with demo from expo-2d-context docs (see below).

expo start

App.tsx:

import { GLView } from "expo-gl";
import React from "react";
import Expo2DContext from "expo-2d-context";

export default class App extends React.Component {
  render() {
    return (
      <GLView style={{ flex: 1 }} onContextCreate={this._onGLContextCreate} />
    );
  }
  _onGLContextCreate = (gl) => {
    var ctx = new Expo2DContext(gl);
    ctx.translate(50, 200);
    ctx.scale(4, 4);
    ctx.fillStyle = "grey";
    ctx.fillRect(20, 40, 100, 100);
    ctx.fillStyle = "white";
    ctx.fillRect(30, 100, 20, 30);
    ctx.fillRect(60, 100, 20, 30);
    ctx.fillRect(90, 100, 20, 30);
    ctx.beginPath();
    ctx.arc(50, 70, 18, 0, 2 * Math.PI);
    ctx.arc(90, 70, 18, 0, 2 * Math.PI);
    ctx.fill();
    ctx.fillStyle = "grey";
    ctx.beginPath();
    ctx.arc(50, 70, 8, 0, 2 * Math.PI);
    ctx.arc(90, 70, 8, 0, 2 * Math.PI);
    ctx.fill();
    ctx.strokeStyle = "black";
    ctx.beginPath();
    ctx.moveTo(70, 40);
    ctx.lineTo(70, 30);
    ctx.arc(70, 20, 10, 0.5 * Math.PI, 2.5 * Math.PI);
    ctx.stroke();
    ctx.flush();
  };
}
AtesDANIS commented 2 years ago

same here...