React-native-camera error: undefined is not an object (evaluating 'CameraManager.Aspect')

I cannot seem to get react-native-camera working in Expo.

The error originates on line 62 of react-native-camera index.js which is calling NativeModules.CameraManager. Does this have something to do with expo not having access to some native apis?

Steps already taken:

  • react-native link react-native-camera
  • watchman watch-del-all
  • rm -rf node_modules && npm install
  • rm -fr $TMPDIR/react-*
  • npm start – --reset-cache
  • Restarting the build

I also created a regular react native app via react-native init and was able to properly set up react-native-camera without any issues.

Any help would be appreciated. Thanks!

You can’t use your own native modules with Expo unless you eject to ExpoKit. Did you do that here?
Here is a guide to that if you need it. https://docs.expo.io/versions/v16.0.0/guides/detach.html#content

There is a basic camera view built into Expo that you can use. It’s documented here: https://docs.expo.io/versions/v16.0.0/sdk/imagepicker.html#expoimagepickerlaunchcameraasyncoptions

We are working on more customizable stuff as well but this is what we have for now.

1 Like

+1 same issue for me.

This is the number 1 thing I’m looking forward to!

You guys did an awesome thing simplifying React Native, especially those pesky notification.

Good luck Greg! God Speed!

Take a look at https://docs.expo.io/versions/latest/sdk/camera.html.

2 Likes