keske / react-native-easy-gestures

React Native Gestures. Support: Drag, Scale and Rotate a Component.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Limit the bounds of the drag

welsh11 opened this issue · comments

Hi there, this is a great library and a real life saver!

I was wondering if there is a way of limiting the bounds where you can drag the contained view.

In my use case I have a video as my subview with a minimum zoom of 1 and a maximum zoom of say 4.

When the video is zoomed in I want them to be able to move the video so that they select a zoomed in portion of the video, however I don't want them to be able drag the video so that any background is visible.

Not sure whether that can be achieved using a mixture of callbacks and enabling/disabling the drag gesture.

As I understand right, you can use draggable prop, when object was zoomed to the mazimum, like this:

const zommed = sclale === 4; // Just example
// ...
<Gestures draggable={zoomed} />