Simple Camera snack works on website, but not when downloaded!

Please provide the following:

  1. SDK Version: 43
  2. Platforms(Android/iOS/web/all): Web

Hello. I have a dead simple Expo Snack with a Camera. It works fine, but when I download the source file and install and expo start on my PC, I get this error. I have been chasing this bug for days, reducing the problem down to it simply being… I have no idea. … I thought it was a dependency, my code etc. My current code actually works on a real Android build, but on the browser (mobile and PC) it dies with this react hook error.

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See for tips about how to debug and fix this problem.

Here is the code and snack. It will work on the snack, but when you download it and try to run it, it won’t! (You can download the source files at the top right)

import React from 'react';
import { Text } from 'react-native';
import { Camera, PermissionResponse, PermissionStatus } from 'expo-camera';

export default function App() {
    const [cameraPermission, setCameraPermission] = React.useState(PermissionStatus.UNDETERMINED);

    const getPermission = async () => {
        const response: PermissionResponse = await Camera.requestCameraPermissionsAsync();

    React.useEffect(() => {
    }, []);

    if(cameraPermission === PermissionStatus.UNDETERMINED){
        return <Text>Requesting camera permission</Text>;
    else if(cameraPermission === PermissionStatus.GRANTED){
        return (
    else {
        return <Text>No access to camera</Text>;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.