我正在开发反应本机博览会应用程序,它使用展会图像选择器并通过使用将该图像保存到不同的位置世博媒体库.
一切似乎都工作正常,但每次用户捕获图像时都会弹出此弹出窗口。这种情况在 Android 上不断发生。它正在影响用户体验。
如果你们能帮我解决这个问题,那就太好了。
谢谢
允许 Expo Go 修改这张照片吗? https://i.stack.imgur.com/wBzul.png
Versions
“反应本机”:“0.64.3”
“世博会”:“〜44.0.0”
"expo-image-picker": "~12.0.2"
"expo-media-library": "~14.0.0"
这是我用来存档提到的功能的代码。
import * as ImagePicker from "expo-image-picker";
import * as MediaLibrary from "expo-media-library";
const savePhoto = async (data, onSucess) => {
const asset = await MediaLibrary.createAssetAsync(data?.uri);
const album = await MediaLibrary.createAlbumAsync(
"TEST_FOLDER",
asset,
false
);
const albumAssets = await MediaLibrary.getAssetsAsync({
album: album,
first: 1,
sortBy: [[MediaLibrary.SortBy.creationTime, false]],
});
if (albumAssets?.assets[0]) {
onSucess(albumAssets.assets[0], data);
}
};
const takePicture = async (onSucess, onError) => {
let data = await ImagePicker.launchCameraAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
quality: 0.8,
allowsEditing: true,
base64: true,
});
if (data.cancelled === false) {
savePhoto(data, onSucess);
} else {
onError();
}
};
这是app.json file.
{
"expo": {
"name": "product",
"slug": "product_frontend",
"version": "1.0.0",
"orientation": "landscape",
"icon": "./assets/images/icon.png",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"plugins": [
[
"expo-media-library",
{
"photosPermission": "Allow $(PRODUCT_NAME) to access your photos.",
"savePhotosPermission": "Allow $(PRODUCT_NAME) to save photos.",
"isAccessMediaLocationEnabled": "true"
}
],
[
"expo-image-picker",
{
"cameraPermission": "Allow $(PRODUCT_NAME) to access your camera",
"photosPermission": "The app accesses your photos to let you share them with your friends."
}
]
],
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.comapny.product",
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"softwareKeyboardLayoutMode": "pan",
"permissions": []
},
"web": {
"favicon": "./assets/images/favicon.png"
},
"scheme": "product"
}
}
如果你们能帮我解决这个问题,那就太好了。
谢谢。