2

Asked permission in componentDidMount

async componentDidMount() {
  await Permissions.askAsync(Permissions.CAMERA);
  await Permissions.askAsync(Permissions.CAMERA_ROLL);
}

Photo picker function

_takePhoto = async () => {
  let pickerResult = await ImagePicker.launchCameraAsync({
     allowsEditing: true,
     aspect: [4, 3]
   });

  this._handleImagePicked(pickerResult);
 };

Render area

<TouchableOpacity onPress={this._takePhoto}>
  <Text> Upload Image </Text>
</TouchableOpacity>

Version

Expo SDK : "^31.0.2"
Tested android version: 7.1

Permission in app

"READ_PHONE_STATE",
"CAMERA",
"READ_INTERNAL_STORAGE",
"WRITE_INTERNAL_STORAGE",
"READ_EXTERNAL_STORAGE",
"WRITE_EXTERNAL_STORAGE"

When I build the apk and run it in device I camera is not opening when I click on the button. Inside expo its working fine.

Sibiraj PR
  • 1,481
  • 1
  • 10
  • 25

0 Answers0