Open MaxJadav opened 1 year ago
@MaxJadav yes its have an media type issue, recently i have move on another library
"@react-native-community/cameraroll": "https://github.com/mirzahayat/react-native-cameraroll.git",
git will give you album data with the help of getAlbum method , and get the media with album name,
e.g type /// SmartAlbum for ios /// Album fro android
getAllAlbum(type) will help you get the Media
const getAllAlbum = async (type: string) => {
const data = await CameraRoll.getAlbums({
assetType: 'All',
albumType: IOS ? type : 'All',
});
const promises = data.map((elem: any) => {
return getDataByAlbum(elem, type);
});
return await Promise.all(promises);
};
return new Promise((resolve, reject) => {
let result = CameraRoll.getPhotos({
first: data.count,
assetType: 'All',
groupName: data.title,
include: [
'fileSize',
'imageSize',
'playableDuration',
'location',
'filename',
],
groupTypes: IOS ? type : 'All',
}).then(res => {
const photos = res.edges;
let groups: any = Array.from(
new Set(photos.map(photo => photo.node.image)),
).map((item: any, index: any) => {
const fileEx = item?.filename?.split('.').pop();
return {
...item,
type: extensionCheck(String(fileEx).toLowerCase()),
uri: IOS
? `assets-library://asset/asset.${String(
fileEx,
).toLowerCase()}?id=${item?.uri.slice(5, 41)}&ext=${String(
fileEx,
).toLowerCase()}`
: item.uri,
};
});
return (
groups && {
title: data.title,
count: data.count,
data: groups,
}
);
});
resolve(result);
});
};
TypeError: null is not an object (evaluating 'MediaLibrary.MediaType')