schovi / react-iscroll

React component for wrapping iScroll http://iscrolljs.com/
MIT License
236 stars 60 forks source link

Initialize immediately when there's no defer prop #6

Closed danscratch closed 8 years ago

danscratch commented 9 years ago

We've been having an issue in which an immediate redirect from a page with a ReactIScroll component causes a crash. _teardownIScroll() ends up getting called before the function in setTimeout(), so this._iScrollInstance is undefined when destroy() is called. So, this pull request just gives the option to defer or not, depending on whether this.props.defer is specified.

Love the library!

schovi commented 8 years ago

Done in https://github.com/schovi/react-iscroll/commit/3a7fb43ea1a35c2ef33fc24ab9f6d424364787ef