expo: [GLView] GLView on RN 0.62 fails on getting context because: undefined is not an object (evaluating 'gl.__exglCtxId = exglCtxId')

¿What?

GLView on RN 0.62 throws error #6583 constantly, in development and in release (on Android) undefined is not an object (evaluating 'gl.__exglCtxId = exglCtxId') I’m using

  • React Unimodules 0.9.0
  • React Native 0.62 (recently released)
  • Expo-GL 0.8.1

Then…

So in my research I arraived to this point! The culprit!? https://github.com/expo/expo/blob/66d2c309df2ba2b976d54fa13015d915129fef94/packages/expo-gl-cpp/android/src/main/jni/EXGL.cpp#L28-L33

To reach that point, I asked a few questions to the code, specifically here https://github.com/expo/expo/blob/876929686c1d843ea016e23fd592cadbbe15a52e/packages/expo-gl/build/GLView.js#L329-L333 I asked the program to print some stuff, and I found out that when I did console.log(global.__EXGLContexts) that returned {"":and here the glcontext} so console.log(Object.keys(global.__EXGLContexts)) -> [""]

Finally (a temporary workaround)

so I was like… heck, let’s try const gl = global.__EXGLContexts[""]; gl.__exglCtxId = exglCtxId; delete global.__EXGLContexts[""]; And that works! But it’s probably nasty, in some way. So that’s that…

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 17 (13 by maintainers)

Most upvoted comments

we generally test compat of libraries in expo sdk against the latest version that we support in the managed workflow (currently 0.61.5) but will move towards 0.62 compat now as the 0.62 release itself stabilizies and we start to use it at expo as well

Looks like this works on a bare project using 0.61, so I’m going to close this issue because of what Brent said above ^

Same issue on a new app I just started on bare workflow expo with RN ~0.61.4. This fix works 😃 although maybe it’s the setter who is wrong, not the getter