Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var fetchParams = {
first: 1000,
groupTypes: groupTypes,
assetType: assetType,
};
if (Platform.OS === "android") {
// not supported in android
delete fetchParams.groupTypes;
}
if (this.state.lastCursor) {
fetchParams.after = this.state.lastCursor;
}
CameraRoll.getPhotos(fetchParams)
.then((data) => this._appendImages(data), (e) => console.log(e));
}
const fetchParams = {
first: 100,
groupTypes,
assetType,
};
if (Platform.OS === 'android') {
// not supported in android
delete fetchParams.groupTypes;
}
if (this.state.lastCursor) {
fetchParams.after = this.state.lastCursor;
}
CameraRoll.getPhotos(fetchParams)
.then(data => this.appendImages(data), e => console.log(e));
}
componentDidMount() {
const fetchParams = {
first: 25,
};
CameraRoll.getPhotos(fetchParams).then((data: any) => {
const assets = data.edges;
const images = assets.map((asset: any) => asset.node.image);
this.setState({
tmpImages: images,
});
const imgArray: any = [];
this.state.tmpImages.forEach(function (image: any, index: number) {
imgArray.push({uri: image.uri, id: index, height: Math.round(Math.random() * 50 + 100)})
});
this.setState({images: imgArray});
}).catch((err: any) => {
console.log("Error retrieving photos");
});
}
componentDidMount(): void {
const fetchParams = {
first: 25,
};
CameraRoll.getPhotos(fetchParams).then((data: any) => {
const assets = data.edges;
const images = assets.map((asset: any) => asset.node.image);
this.setState({
tmpImages: images,
});
const imgArray: any = [];
this.state.tmpImages.forEach(function (image: any, index: number) {
imgArray.push({uri: image.uri, id: index, height: Math.round(Math.random() * 50 + 100)})
});
this.setState({images: imgArray});
this.onBlurViewLoaded.bind(this)
}).catch((err: any) => {
console.log("Error retrieving photos");
});
}
async function getInitalGalleryContents() {
try {
const photos = await CameraRoll.getPhotos({
first: GALLERY_IMAGE_PER_PAGE,
})
setGalleryContents(
photos.edges.map(({ node: { image: { filename, uri }, type: mime } }) => ({
filename: filename || '',
uri,
mimeType: mime,
})),
)
setGalleryImageEndCursor(photos.page_info.has_next_page ? photos.page_info.end_cursor : null)
} catch (err) {
console.log('getPhotos err', err)
}
}
getCameraRollPhotos = (params: any) => CameraRoll.getPhotos(params)