evetstech / react-native-animated-ptr

an easy-to-create custom animated pull to refresh component
https://evetstech.github.io/react-native-animated-ptr/
MIT License
150 stars 17 forks source link

Error when pop the page with a PullToRefresh #7

Open Liuthx opened 7 years ago

Liuthx commented 7 years ago

react-native: 0.39.2 When I pop the page with a PullToRefresh, It shows the error: 'Cannot read property 'removeListener' of undefined', like this:

image

code in TimedAnination.js, line 96:

  componentWillUnmount() {
    if(this.triggerBindID) {
      this.state.scrollY.removeListener(this.triggerBindID);
    }
  }

should I modify the code link this, and what should I do next?:

  componentWillUnmount() {
    if(this.triggerBindID) {
      this.state.scrollY && this.state.scrollY.removeListener(this.triggerBindID);
    }
  }
evetstech commented 7 years ago

Sorry about the late reply, can you post a little more code of what you're doing when you're popping? I can't reproduce the error.

Liuthx commented 7 years ago

I only pop the navigator stack: onPress={()=>{this.props.navigator.pop()}}

Here is a demo. https://github.com/Liuthx/ptr_bug_test

leonardollobato commented 7 years ago

any resolution for this issue?

tikkichan4 commented 7 years ago

Same problem...Any workaround for this issue ?