The Camera preview component from the npm package 'expo-camera' doesn't show anything but a black screen. I've even created a brand new managed Expo project with nothing but this code:
import React from 'react';import { StyleSheet, Text, View } from 'react-native';import { Camera } from 'expo-camera';export default function App() { return (<View style={styles.container}><Camera /></View> );}const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', },});
This is my package.json file:
{"main": "node_modules/expo/AppEntry.js","scripts": {"start": "expo start","android": "expo start --android","ios": "expo start --ios","web": "expo start --web","eject": "expo eject" },"dependencies": {"expo": "^35.0.0","expo-camera": "^7.0.0","react": "16.8.3","react-dom": "16.8.3","react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz","react-native-web": "^0.11.7" },"devDependencies": {"babel-preset-expo": "^7.1.0" },"private": true}
And this is my app.json:
{"expo": {"name": "testcamera","slug": "testcamera","privacy": "public","sdkVersion": "35.0.0","platforms": ["ios","android","web" ],"version": "1.0.0","orientation": "portrait","icon": "./assets/icon.png","splash": {"image": "./assets/splash.png","resizeMode": "contain","backgroundColor": "#ffffff" },"updates": {"fallbackToCacheTimeout": 0 },"assetBundlePatterns": ["**/*" ],"ios": {"supportsTablet": true } }}
It just stopped working out of the blue. Last thing I did was publish the Expo project, and it was working before that.