Reputation: 12385
I created a RN
project with create-react-native-app (CRNA)
. I want to use the Camera API
provided by expo
. In doing so, I simply copied the example here https://docs.expo.io/versions/latest/sdk/camera.html and included the Component
. Starting the App gives me the following: Undefined is not an object _expo.camera.constant
with a massive stacktrace... Any ideas what is going wrong here?
Upvotes: 0
Views: 2157
Reputation: 139
For those that are having problems with the camera set up. Just change: import {Camera, Permissions}
... by these lines:
import * as Permissions from 'expo-permissions';
import { Camera } from 'expo-camera';
You will need to install the camera so you need to install using this command:
expo install expo-camera
Now just run your app and Cheers!
Upvotes: 3
Reputation: 31
I ran into the same issue trying to use Expo Camera API into a CRNA project. I manage to access the Camera API with an Expo SDK upgrade. Here are the steps I followed:
app.json
change my Expo SDK version : "sdkVersion": "20.0.0",
package.json
change my current dependencies for Expo, React and React Native:"expo": "20.0.0-alpha.4",
"react": "16.0.0-alpha.12",
"react-native":"https://github.com/expo/react-native/archive/sdk-20.0.0.tar.gz",
node_modules
foldernpm install
againThese steps didn't break the packager: I still can launch my project with npm start
and from Expo XDE. Though, I didn't take time to test side effects, particularly for the eject process provided by CRNA.
I could only advice to test this fix on a not-for-production app.
Nonetheless, hope this could help!
Upvotes: 1