I'm developing react native expo application which takes photo using expo-image-picker and saves that image into a different location by using expo-media-library.
Everything seems to be working fine but this pop up keeps getting every time user captures the image. This keeps happening on Android. It's affecting UX.
It would be great if you guys could help me to sort out this issue. Thanks
Allow Expo Go to modify this photo?
Versions
"react-native": "0.64.3"
"expo": "~44.0.0"
"expo-image-picker": "~12.0.2"
"expo-media-library": "~14.0.0"
Here is the code which I'm using to archive mentioned functionality.
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();
}
};
And here is the 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"
}
}
It would be great if you guys cold help me to sort out this issue. Thanks.