React Native Zoomable View - 子组件应该具有 onPress 且可平移

问题描述 投票:0回答:1

我有一个父组件(ReactNativeZoomableView),其中有一个带有可点击元素的嵌套组件,问题是我希望用户能够按下该元素以打开其侧面菜单或按下并平移以在屏幕上移动。

使用的库https://www.npmjs.com/package/@openspacelabs/react-native-zoomable-view?activeTab=readme#pan-responder-hooks

在元素外部平移效果很好,只是在元素上却不行。

<ReactNativeZoomableView
  ref={zoomRef}
  maxZoom={1.5}
  minZoom={0.5}
  initialZoom={1}
>
<Svg 
  width={width} 
  height={height}
  style={{backgroundColor:'red'}}
>
 {nodeElements.map((element, element) => {
   <Element
     element={element}
     element={element}
    />
 }}
</Svg>
</ReactNativeZoomableView>

元素如下所示:

<G
 onPress={handlePress}
>
.....
</G>

我尝试使用 onMoveShouldSetResponderCapture 让父级处理平移事件,但这不起作用。尝试过让乞讨者也没有用。

抱歉,如果帖子结构不好,我们将提供任何所需的代码或信息。预先感谢

react-native pan react-native-gesture-handler
1个回答
0
投票

这里同样的问题。你想通了吗?

© www.soinside.com 2019 - 2024. All rights reserved.