deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native
MIT License
917 stars 235 forks source link

App crash if I unmount the component faster than the end of the animation #109

Closed Nhacsam closed 6 years ago

Nhacsam commented 6 years ago

Hi, Thanks for that amazing component.

I found a bug which make my app crash if I navigate too fast. The bug is here: https://github.com/deanmcpherson/react-native-sortable-listview/blob/master/index.js#L449


  componentDidMount() {
    InteractionManager.runAfterInteractions(() => {
      setTimeout(this.measureWrapper, 0)
    })
}

If I go too fast and the component is Unmounted before the end of the animation, (or just at the end), this.measureWrapper is called on an unmounted component and this.refs is undefined.

nihgwu commented 6 years ago

Thanks for your report, can you verify if my fix works?

Nhacsam commented 6 years ago

@nihgwu It works ! Thanks a lot for your reactivity.