Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Expo Camera

The react native expo camera example gives errors like _Camera is not defined https://docs.expo.io/versions/latest/sdk/camera.html but I see others have gotten it to work here

Does anyone have some basic code on how to make use of the camera module? Or debug why the documentation example isn't working?

like image 215
Greg Benner Avatar asked Sep 04 '17 13:09

Greg Benner


People also ask

Can I use Expo camera in React Native?

For this, we will use a Simple library called expo-camera . This supports various camera functionalities like zoom, auto focus, white balance and flash mode, etc. So let's get started, first you have to need to set up the mobile application using expo-cli. For this, you can follow Setup react native app using expo.

Is Expo Better than React Native?

It helps you from the creation to distribution of your React Native apps. Remember, when you are coding in Expo, you still write React Native code. But with the support of the Expo CLI and Expo Client on your smartphone. It is better to use Expo CLI if you are new to app development.


1 Answers

I got same issue, after a lot of research Expo Camera is added from v20.I was using v19.0. I am new to Expo and did not realize it was added in v20 here. Problem is solved after upgrading react-native expo version to v20. .basic code for camera in expo is here

edit in package.json

"react-native": "https://github.com/expo/react-native/archive/sdk-20.0.0.tar.gz",

"expo": "20.0.0-alpha.4",

"react": "16.0.0-alpha.12",

edit in app.json

"sdkVersion": "20.0.0",
  • Delete your project’s node_modules directory and run npm install

  • Reopen your project in XDE and press “Restart” to clear the packager cache

like image 77
Anjal Saneen Avatar answered Sep 19 '22 20:09

Anjal Saneen