openspacelabs / react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.
MIT License
191 stars 58 forks source link

zoomTo without animation #18

Open stopachka opened 2 years ago

stopachka commented 2 years ago

Hey team,

Problem:

Say I have a ScrollView with pagingEnabled. When I "leave" the view, I want to be able to "reset" the zoom level of the image to it's initial level.

Right now, this reset will cause an animation. It can feel a bit off though, if the user quickly paginates back and forth.

Maybe there should be a way to "instantly" zoom to a particular level?

elliottkember commented 2 years ago

@stopachka Hi Stepan - sorry for the late reply I didn't see your comment.

Could you use a key to re-mount the component when it is unfocused? You could have key={focused ? "focus" : id} which would reset the component when it becomes focused or unfocused. Not ideal but might work!

liquidvisual commented 2 years ago

Just ran into this myself, thanks @elliottkember - can confirm it works.

lhr000lhr commented 2 years ago

worked. Thanks a lot.