-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Unhandled promise rejection: TypeError: null is not an object (evaluating 'gl.canvas.width')] #202
Comments
I have the exact same problem |
I finally fix it by downgrading threejs "three": "0.126.1"
"expo-three": "5.7.0" hopefully that can help you :) |
@chiliwax, i've tried downgrading three to the mentioned version, to no luck... Do you care to post the |
I didn't had to downgrade threejs. |
@migupry Encountered this too. Your solution works, thanks!
I'm currently using SDK 41, same as you. Edit : OK I've looked at the GLView source code, it seems the canvas has always been null at the point that onContextCreate is called, so it's likely that this error is due to a change in how Three.JS initialized things, likely in initGLContext() according to the logs. |
Might be this change in THREE.JS from 2 months ago, since it's the only place in that initGLContext() function that seems to reference the GL context. It's in the WebGLState object. Would need to check a bit, but I think this might be the cause of the problem. |
This should be fixed with the next release of Three.JS 🎉 |
@migupry yes, it works, but then there was another problem
|
Hmm that's strange. I didn't face this. Care to post your code maybe? Maybe it makes sense to create a new issue, because this doesn't seem to be related to the inital error. |
@migupry it worked before:
|
Ok, i've tested your code, and it does not work. But I'm 100% sure this is not releated to this issue. Check this link. RectAreaLightHelper has been dropped from ThreeJS core, and you need to import it as such: Also, you need to adjust your code accordingly, so use: |
@migupry ok, thank you very much, |
Hello,
I have just discovered this library and attempting to use it.
I have cloned the example project multiple times and every time I run the project I get error that gl.canvas is null.
Code
`
import { ExpoWebGLRenderingContext, GLView } from 'expo-gl'
import { Renderer, TextureLoader } from 'expo-three'
import * as React from 'react'
import {
AmbientLight,
BoxBufferGeometry,
Fog,
GridHelper,
Mesh,
MeshStandardMaterial,
PerspectiveCamera,
PointLight,
Scene,
SpotLight,
} from 'three'
export default function App() {
let timeout
}
class IconMesh extends Mesh {
constructor() {
super(
new BoxBufferGeometry(1.0, 1.0, 1.0),
new MeshStandardMaterial({
map: new TextureLoader().load(require('./assets/icon.png')),
// color: 0xff0000
})
)
}
}
`
Here are my dependencies
The text was updated successfully, but these errors were encountered: