Skip to content
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

TypeError: Cannot read properties of undefined (reading 'removeEventListener') during run testing library react #3371

Closed
jjuszkiewicz opened this issue Oct 2, 2024 · 3 comments · Fixed by #3375
Labels
bug Something isn't working React Three Test Renderer

Comments

@jjuszkiewicz
Copy link

Hello,
in version 8.17.9 appear below error. Error appears during run tests by testing library react:

TypeError: Cannot read properties of undefined (reading 'removeEventListener') at removeListeners (../../node_modules/.pnpm/@react-three+fiber@8.17.9_react-dom@18.2.0_react@18.2.0__react@18.2.0_three@0.153.0/node_modules/@react-three/fiber/dist/react-three-fiber.cjs.dev.js:138:26)

Looks like the problem is in this code:

if (state.current.orientationHandler) {
  screen.orientation.removeEventListener('orientationchange', state.current.orientationHandler);
}

The version 8.17.8 works fine.

Could you verify on your side?

@DennisSmolek
Copy link
Contributor

I’ve heard this is on Linux too. Either they don’t have a screen global or no orientation prop.

I’ll work on a pr of this

@dll21
Copy link

dll21 commented Oct 7, 2024

Hey,
I get the following error with the Canvas component, while testing my app on iOS safari.
TypeError: undefined is not an object (evaluating ‘screen.orientation.removeEventListener’)

It might be related to the issue you're facing @jjuszkiewicz

Also switching to version 8.17.8 didn't resolve the problem

It seems like the screen.orientation API is being called in the iOS environment, but it’s not supported there.
see issue akamai/boomerang#214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working React Three Test Renderer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants