question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PanResponder onPanResponderRelease doesn't calls on Android

See original GitHub issue

I have this code in my render function.

<Animated.View
        style={[styles.wrap, { left }]}
        {...this.scrollResponder.panHandlers}
      >
        {initialRender &&
          <View style={styles.wrap} {...this.listViewResponder.panHandlers}>
            <ListView
              ref={ref => this.listView = ref}
              onScroll={this.handleScroll}
              dataSource={posts}
              renderRow={this.renderRow}
              renderSectionHeader={this.renderHeader}
              onEndReachedThreshold={300}
              onEndReached={this.getPosts}
              enableEmptySections={true}
              refreshControl={
                <RefreshControl
                  refreshing={refreshing}
                  onRefresh={this.onRefresh}
                />
              }
            />
            {!onProfile && this.renderSettings()}
          </View>
        }
        {this.renderComments()}
        {loading && !refreshing && <Loading />}
      </Animated.View>
componentWillMount() {
    this.listViewResponder = PanResponder.create({
      onMoveShouldSetPanResponderCapture: this.setMove,
      onPanResponderMove: this.handleMove,
      onPanResponderRelease: this.handleMoveEnd,
      onPanResponderTerminationRequest: () => false
    });
    this.scrollResponder = PanResponder.create({
      onStartShouldSetPanResponderCapture: (e) => e.nativeEvent.pageY < THUMB_SIZE,
      onPanResponderRelease: this.handlePress,
    });
  }

It’s works fine on iOS, But on Android onPanResponderRelease doesn’t calls every time.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
mikeygeecommented, Sep 8, 2016

I am also having an issue with Android only. In my case, I am putting pan responder handlers on a ListView. It detects my gesture starting, but if the gesture also scrolls the list view, it seems to stop responding (stops calling onPanResponderMove and also never calls onPanResponderTerminate or onPanResponderRelease). It works fine on iOS. For Android, it seems to only work on non-scrolling views.

1reaction
smallpathcommented, Sep 2, 2016

Hello, on Android, onPanResponderTerminate will be called rather than onPanResponderRelease, you can add following statement to make it work

onPanResponderTerminate: this.handleMoveEnd
Read more comments on GitHub >

github_iconTop Results From Across the Web

react native - onPanResponderRelease not being triggered
I got it working properly by using onPanResponderEnd instead of onPanResponderRelease . Also if we still want to use onPanResponderRelease ...
Read more >
PanResponder — gestures not working - React native
In my case, I followed the official RN docs for pan-responder. It responded on iOS but not any android phone I tested on....
Read more >
What are the main differences between ReactJS and React ...
Those React-Native components map the actual real native iOS or Android UI ... similar to the Javascript touch events web API called the...
Read more >
[Solved]-Limit PanResponder movements React Native-React ...
How can I start a service so that it keeps running even after app closes/killed in an Android app using React-Native/hybrid? ... How...
Read more >
8 Implementing cross-platform APIs - React Native in Action
Alert can be triggered by calling the alert method ( Alert.alert ). ... gets called if the PanResponder does not register // do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found