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

Cannot drag when child component has onPress - ReactNativeZoomableView #101

Open aaydin29 opened 2 months ago

aaydin29 commented 2 months ago

Hello, as seen in the code I shared below, there is an onPress in the Path in ReactNativeZoomableView. The dragging function works successfully from areas not covered by this path, but if I try to do this on the Path, the dragging does not work. I have no other way than having the two work together for the project I'm developing.

<ReactNativeZoomableView
  ref={zoomableViewRef}
  maxZoom={maxZoom}
  minZoom={minZoom}
  zoomStep={0.5}
  initialZoom={1}
  bindToBorders={false}
  contentWidth={2000}
  contentHeight={857}
>
  <Svg width={2000} height={857}>
    {data.map((item, index) => (
      <Path
        key={index}
        d={item.path}
        fill={'#fff'}
        stroke="black"
        strokeWidth={0.75}
        onPress={() => {
          console.log(`${item.name} clicked!`);
        }}
      />
    ))}
  </Svg>
</ReactNativeZoomableView>