This commit is contained in:
Paul Frazee 2022-12-02 10:40:22 -06:00
parent 90942ae146
commit ea27b9ed08
5 changed files with 18 additions and 20 deletions

View file

@ -18,8 +18,8 @@ export class UserLocalPhotosModel {
}
private async _getPhotos() {
runInAction(() => {
CameraRoll.getPhotos({first: 20}).then(r => {
CameraRoll.getPhotos({first: 20}).then(r => {
runInAction(() => {
this.photos = r.edges
})
})

View file

@ -23,9 +23,14 @@ export const PhotoCarouselPicker = ({
cropping: true,
width: 1000,
height: 1000,
}).then(item => {
setSelectedPhotos([item.path, ...selectedPhotos])
})
}).then(
item => {
setSelectedPhotos([item.path, ...selectedPhotos])
},
_err => {
// ignore
},
)
}, [selectedPhotos, setSelectedPhotos])
const handleSelectPhoto = useCallback(
@ -58,14 +63,7 @@ export const PhotoCarouselPicker = ({
})
result.push(img.path)
}
setSelectedPhotos([
// ...items.reduce(
// (accum, cur) => accum.concat(cur.sourceURL!),
// [] as string[],
// ),
...result,
...selectedPhotos,
])
setSelectedPhotos([...result, ...selectedPhotos])
})
}, [selectedPhotos, setSelectedPhotos])