Anthonyzou / react-native-image-zoom

Image pan and zoom for Android
https://www.npmjs.com/package/react-native-image-zoom
MIT License
115 stars 52 forks source link

Reset image-scale in ViewPager #36

Open justinhouse opened 7 years ago

justinhouse commented 7 years ago

I'm not sure if it's possible, but when using this on Android in combination with the ViewPager as suggested - I'd prefer it if pages/images out of view reset to their initial scale of 1.0. When a a user swipes to a page the 1.0 scale gives them the most ideal version within the context of a gallery.

I tried getting a reference to the ViewManager/'ImageViewZoom'. This has a @ReactProp annotation, but that only seems to get triggered on it's initial render. imageReference.scale = 1 does nothing for example (doesn't trigger in Java-code even).

Getting the ZoomImage in index.android.js to render again with the property 'scale' set to '1' doesn't reset it back after it's been initially rendered either.

I'm fairly new to ReactNative so maybe what I want is not done, or I'm missing the proper way to go about this. Either way, if there's some pointers to be given that would be much appreciated.