Do not use deprecated `isMounted`

release
Etienne Lemay 2016-07-15 12:31:22 -04:00
parent 9eb8f0b6ac
commit 2feae02477
1 changed files with 6 additions and 2 deletions

View File

@ -33,8 +33,7 @@ export default class Picker extends React.Component {
componentDidMount() { componentDidMount() {
if (this.state.firstRender) { if (this.state.firstRender) {
setTimeout(() => { this.firstRenderTimeout = setTimeout(() => {
if (!this.isMounted) return
this.setState({ firstRender: false }) this.setState({ firstRender: false })
}, 60) }, 60)
} }
@ -45,6 +44,11 @@ export default class Picker extends React.Component {
this.handleScroll() this.handleScroll()
} }
componentWillUnmount() {
clearTimeout(this.leaveTimeout)
clearTimeout(this.firstRenderTimeout)
}
testStickyPosition() { testStickyPosition() {
var stickyTestElement = document.createElement('div') var stickyTestElement = document.createElement('div')
for (let prefix of ['', '-webkit-', '-ms-', '-moz-', '-o-']) { for (let prefix of ['', '-webkit-', '-ms-', '-moz-', '-o-']) {