expo-three-orbit-controls
expo-three-orbit-controls copied to clipboard
TypeError: Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
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?
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
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;
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.