Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
94 views
in Technique[技术] by (71.8m points)

android - Cross handler interactions between ScrollView and PanGestureHandler

I have a bottom sheet wrapped in a PanGestureHandler from react-native-gesture-handler. Inside, there is a header and a ScrollView, imported from the same library mentioned above. I want the PanGestureHandler to take over any time the content offset in the Scrollview is less than or equal to 0 (i.e. at the top). I tried using simulatenousHandlers property but it doesn't seem to be working on iOS.

My code for reference:

<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>

What can I do in order to achieve my goal?

question from:https://stackoverflow.com/questions/65881333/cross-handler-interactions-between-scrollview-and-pangesturehandler

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...