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: Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method. #36

Open
artursahak opened this issue Nov 4, 2021 · 3 comments

Comments

@artursahak
Copy link

const [camera, setCamera] = React.useState<Camera | null>(null); at line 20 is giving the TypeError of being a non-iterable instance.
Could you suggest another way for handling the state for view's camera variable?

@Dionise
Copy link

Dionise commented Mar 29, 2022

const [camera, setCamera] = React.useState<Camera | null>(null); at line 20 is giving the TypeError of being a non-iterable instance. Could you suggest another way for handling the state for view's camera variable?

Same problem

@ts-web
Copy link

ts-web commented Dec 3, 2022

Same issue. The current App.tsx sample code does not work with the latest expo libraries.

The "non-iterable" error happens because camera is null on the first render. One workaround is to initialize it immediately and not use useState:

  const camera = new PerspectiveCamera(
    75,
    1, // initial aspect of 1
    0.1,
    1000
  );

    // in onContextCreate
    camera.aspect = width / height;

@A7640S
Copy link

A7640S commented Aug 16, 2024

Hi, i have the same error
ERROR TypeError: Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a Symbol.iterator method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants