使用expo-image-picker拍照时,expo客户端应用程序崩溃并在拍照后重新加载
使用 expo-image-picker 时,我的 Android 手机上的 expo 客户端应用程序在拍照后崩溃。 单击完成符号后,应用程序重新加载
这是我的代码:
import * as ImagePicker from "expo-image-picker";
const takeImageHandler = async () => {
const hasPermission = await verifyPermissions();
if (!hasPermission) {
return;
}
const image = await ImagePicker.launchCameraAsync({
allowsEditing: true,
aspect: [16, 9],
quality: 0.5,
});
console.log(image);
};
when working with expo-image-picker, expo client app on my android phone crashes after taking picture.
after clicking on done symbol the app reloads
here is my code:
import * as ImagePicker from "expo-image-picker";
const takeImageHandler = async () => {
const hasPermission = await verifyPermissions();
if (!hasPermission) {
return;
}
const image = await ImagePicker.launchCameraAsync({
allowsEditing: true,
aspect: [16, 9],
quality: 0.5,
});
console.log(image);
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需尝试使用此代码
}
并确保您已使用 npm 最新版本安装了图像选择器
必须再次检查您的 package.json 是否安装了 expo 图像选择器
Just try using this code
}
And make sure you have installed image picker using npm latest version
Must check your package.json again that expo image picker is installed or not
我今天在使用 expo-image-picker 库时遇到了同样的问题。我能够打开相机并拍摄图像,但当我尝试通过单击刻度线保存图像时,应用程序会重新加载。因此,我在另一部手机上进行了测试,效果非常好。
我测试的第一部手机是旧的 Android 手机,第二部是较新的 Android 手机,所以我建议您使用较新/最新的型号。
I had the same problem while working with the expo-image-picker library today. I was able to open the camera and take the image but as soon as i tried to save the image by clicking the tick mark, the app reloaded. So, i tested it on my another phone and it worked perfectly.
The first phone that i was testing on was on old android phone and the second one was a newer android, so i suggest you use a newer/latest model.