Glazzes / react-native-zoom-toolkit

Zoom anything you want! Most complete pinch to zoom utilities for React Native
https://glazzes.github.io/react-native-zoom-toolkit/
MIT License
193 stars 11 forks source link

[Gallery] Prop support to disable image to zoom at particular index #45

Closed cw-nikhilnaik closed 3 months ago

cw-nikhilnaik commented 3 months ago

Hi, hope you are having a great day

Lets say I have a gallery component which render's 10 images. But I dont want all 10 images to be zoomed. I dont want the 5th image in array be zoomed. I want the starting 4 images be zoomed and the last 5 images be zoomed not the middle one.

Is this possible with current version? If we have to add a support for it, then how much effort would that take?

Thankyou

Glazzes commented 3 months ago

Hi there, hope you are doing good aswell. It depends on how problematic you find the current way of achieving it is, if you're using the maxScale property by providing the resolutions array all you need to do is to set the 5th position with something like {width: 1, height: 1} this will keep the maxScale always at one for this particular item, in theory its not disabled as you can pinch a bit as long as you hold the gesture, but it's the closest to what you want.

cw-nikhilnaik commented 3 months ago

I used the approach you suggested, it works for doubleTap, for unfortunately it was able to be zoomed In and zoomedout because of pinch. I was able to provide certain changes to your package. If you think this feature will be useful, I will raise a PR or else I will use the feature in my fork.

Glazzes commented 3 months ago

Your use case per se is way too niche for a prop to be something this specific, however I'm not against the idea of disabling zoom, maybe pinchEnabled and doubleTapEnabled properties would be good additions, this in combination with the onIndexchange callback would suffice your needs.

Glazzes commented 2 months ago

I just released version 3.0.0 which includes zoomEnabled and scaleMode properties, both properties when used together may be solve your issues.