mdjfs / expo-image-multiple-picker

Fully customizable image picker for react native
https://npmjs.com/expo-image-multiple-picker
MIT License
21 stars 7 forks source link

[Feature Request] Accept an array of Assets in order to edit #3

Closed MrSinaRJ closed 2 years ago

MrSinaRJ commented 2 years ago

Why Right now the only way to edit a user's selected assets is to manually show them and after selection add/remove them to/from the assets array.

How (suggestion) Editing a user's selection requires opening the <ImagePicker/> with assets selected so the user can edit the selection. It can be an optional parameter. It can be passed an empty array which can be handled by useState so the user has control over the selected assets and pass them to <ImagePicker/> as a value like the following:

const [content, setContent] = useState([]);

<ImagePicker
      onSave={(assets) => setContent(assets)}
      onCancel={() => console.log('no permissions or user go back')}
      multiple
      selected={content}
/>
mdjfs commented 2 years ago

Hello! How are you?

Thanks for the feedback! I updated the library with the version 4.5.0

Now, you can pass the selected prop with selected assets. Also, for convenience. You have 2 more props:

Is more convenient, when you track the selected assets, also know which album is (if the user select the assets of specific album). Because is confuse if you open an album, select any assets, and then re-open the picker with your selected assets disorded with any other assets of other albums

For more information about the usage, in the readme i left some documentation

image

Please test it and let me know if works to close the issue

MrSinaRJ commented 2 years ago

Hey man, Thanks for the update and much-needed enhancement. I have 2 problems with it:

  1. When you open the Image Picker and pass the selected array you will go to the last Album which was open, but when you change Album, it's like "selected" assets won't be shown anymore.
  2. You can't select photos from different Albums in one take (I don't know if it existed before or if it's a new thing, I didn't check this before)

It's an amazing repo it can be one of the leading projects in the expo. I don't know if you're open to collaboration, but I see some great potential in this awesome library.

mdjfs commented 2 years ago

Hi!

You're welcome. Thanks for the feedback!

That isn't a bug, when you go back to select an Album, the assets will be unselected. And also is the reason about why you can't select photos from different Albums in one take. The only way to select photos from different albums right now is use the noAlbums property

That is a great feature. It requires some code but is possible select assets from different albums

Thanks for check this library. The point is the personalization, performance and basic interfaces

I'm totally open to collaboration. If you want feel free to do a pull request about this new feature required I'll check it gracefully

PD: Probably add multiAlbum property in the picker to select assets for multiple albums in one take