我有一张底纸包裹在 PanGestureHandler
的 react-native-gesture-handler
中。在里面,有一个标题和一个 ScrollView,从上面提到的同一个库中导入。我希望 PanGestureHandler 在 Scrollview 中的内容偏移量小于或等于 0(即在顶部)时接管。我尝试使用 simulatenousHandlers
属性,但它似乎不适用于 iOS。
我的代码供参考:
<PanGestureHandler
ref={panRef}
onGestureEvent={onGestureEvent}
onHandlerStateChange={onHandlerStateChange}
simultaneousHandlers={scrollRef}
>
<Animated.View
style={{
position: "absolute",
bottom: 0,
width: "100%",
height: height * 0.7,
transform: [
{
translateY: bottomSheetY.interpolate({
inputRange: [0, height],
outputRange: [0, height],
extrapolate: "clamp",
}),
},
],
}}
>
<HandleHeader imageSource={"https://picsum.photos/300"} />
<ScrollView
bounces={false}
ref={scrollRef}
scrollEventThrottle={16}
simultaneousHandlers={panRef}
>
<MoreInfo />
</ScrollView>
</Animated.View>
</PanGestureHandler>
我可以做什么来实现我的目标?