I’m trying to use the launchcamerasync sdk and got the following codes from some website. I can use launchImageLibraryAsync with no problem, but not ImagePicker.launchCameraAsync..
It has no error return on console. The Camera opens for a split of a second…and then it just crashes and expo freeze. And nothing happens…
_pickCamera = async () => {
const permissions = Permissions.CAMERA;
const { status } = await Permissions.askAsync(permissions);
console.log('Permission =>', permissions);
console.log('Status => ', status);
console.log(`[ pickFromCamera ] ${permissions} access: ${status}`);
if (status !== 'granted') {
Sentry.captureException(new Error(`[ pickFromCamera ] ${permissions} access: ${status}`));
} else {
let image = await ImagePicker.launchCameraAsync().catch(error => console.log({ error }));
console.log(image);
}
}
The above code returns the following in console.log and nothing else. Camera crash. Expo freeze.
10:39:46: Permission => camera
10:39:46: Status => granted
10:39:46: [ pickFromCamera ] camera access: granted
CAMERA_ROLL access was already granted before.
Environment:
OS: macOS High Sierra 10.13.4
Node: 8.11.1
Yarn: 1.6.0
npm: 6.0.1
Watchman: 4.9.0
Xcode: Xcode 9.3.1 Build version 9E501
Android Studio: 2.3 AI-162.3764568
Packages: (wanted => installed)
expo: ^27.0.1 => 27.0.2
react: 16.3.1 => 16.3.1
react-native: ~0.55.2 => 0.55.4