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
205 stars 57 forks source link

PanResponder doesn't begin when TouchableOpacity is inside #23

Closed felixchan closed 2 years ago

felixchan commented 2 years ago
<ReactNativeZoomableView >
    <TouchableOpacity
    onPress={() => {}}
    >
        <View style={{ width: 60, height: 60}}/>
    </TouchableOpacity>
</ReactNativeZoomableView

Is there a way to enable dragging when the user initially touches the child view? The dragging currently works when the user is outside the child view.

professorkolik commented 2 years ago

@felixchan I am not the maintainer but spent a lot of time with this library. Though I think it's impossible to have TouchableOpacity inside ReactNativeZoomableView.

Can you give some example of usecase?

elliottkember commented 2 years ago

I don't think this is currently possible, sorry. The event is captured by the TouchableOpacity.

thomasttvo commented 2 years ago

This is an interesting use case. We'll think about supporting it in later versions. For now, the best solution is detect the tap position and respond accordingly. Use onSingleTap callback. https://github.com/openspacelabs/react-native-zoomable-view/blob/master/src/typings/index.ts#L55. I've also just realized the README doesn't mention this callback. It will be added to the doc soon.