I want to add limitations on how far by Y axis can View be dragged inside other View. My onPanResponderMove looks something like this:
onPanResponderMove: (evt: any, gestureEvent: any) => {
if (y >= 0 && y <= backgroundHeight - 40) {
Animated.event([null, { dx: pan.x, dy: pan.y }], { useNativeDriver: false })(evt, gestureEvent);
} else if (y < 0) {
pan.setValue({ x: pan.x._value, y: 0 });
} else {
pan.setValue({ x: pan.x._value, y: backgroundHeight - 40 });
}
}
So now inner View still draggs when its scrolled further limitations and goes back (looks like it's shaking). And I want drag stop on hitting these limitations and don't know how.
If there is another better solution, that can be implemented, I'd much appreciate your help :)