natysoz/expo-images-picker

Proposal to store id and other data in returned data object from resize method.

eric-personal opened this issue · 1 comments

Hi all working on this project. First off thank you for all the work you have done on this amazing package. I've been playing around with the package and noticed the data returned from the resize method has none of the the original data which can be useful to know along with the new resized data. Particularly the original id which I use for React keys when rendering all the images in a FlatList. So I'm proposing something like this and wanted to see how you all felt.

In the manipulateResults() function in AssetsSelector.tsx where the resize code is run I'd like to spread the asset props into modAssets[{}].
Example:

          if (Resize) {
                let modAssets: (ImageManipulator.ImageResult &
                    MediaLibrary.Asset)[] = []
                await asyncForEach(selectedAssets, async (asset: Asset) => {
                    if (asset.mediaType === 'photo') {
                        const resizedImage = await resizeImages(asset, Resize)
                        modAssets.push({
                            ...asset,
                            ...resizedImage,
                        })
                        
                    } else modAssets.push(asset)
                })

This now returns all the prior data along with the new resize data ?

ill add this option