Expo ImagePicker在android中无法正常工作

时间:2019-02-27 07:37:27

标签: react-native expo react-native-image-picker

componentDidMount中寻求许可

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

照片选择器功能

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

  this._handleImagePicked(pickerResult);
 };

渲染区域

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

版本

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

应用权限

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

当我构建apk并在设备中运行它时,单击该按钮时相机未打开。内部博览会正常。

0 个答案:

没有答案