react-native-image-gallery
react-native-image-gallery copied to clipboard
Swipe down to close
I'm trying to figure out a way to spy on the gesture state to detect velocity and direction to close the gallery when criteria are met. Like when the user swipes down och "throw" a pic away. Any ideas how to do this?
Hi, this is actually a very nice feature that I'd like to see implemented.
However, it would require significant changes in the library.
The thing is, the component right now only consists of a gallery, there is no provided component that renders the thumbnails you would tap to open the gallery.
To achieve that, with the opening animation, and the closing one where you would "throw" the gallery away, I guess it would require to render the gallery in absolute position above your app, so we can animate it from a 100% width/height size, to the size of your thumbnails, or something like that.
It means the gallery wouldn't need to be a in specific view handled by user's navigator, which is a quite big change.
I'll look into it to see if this effect is achievable without making such big changes, or if we could add necessary props so people could add it themselves in their own app's codebase.
Ideally, it would behave like the photoswipe JS library which is simply glorious.
Yup, I hear you. A semi good option would be to just "throw" the image away and that would trigger an action (that one could map to "close"). This wouldn't animate the image back to its thumbnail position, but it would work perhaps as an "middle road" that's easier to implement.
Yep, that should be our first step. If we improve it later on, we'll still need that development anyway. I might look into it after we've release 2.0.0.
I wrote some code to do this. If this pull request is accepted you could implement this.