From 2feae024770c16fdd06355e9532626ea271783ed Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Fri, 15 Jul 2016 12:31:22 -0400 Subject: [PATCH] Do not use deprecated `isMounted` --- src/components/picker.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/picker.js b/src/components/picker.js index 64fd11b..927a154 100644 --- a/src/components/picker.js +++ b/src/components/picker.js @@ -33,8 +33,7 @@ export default class Picker extends React.Component { componentDidMount() { if (this.state.firstRender) { - setTimeout(() => { - if (!this.isMounted) return + this.firstRenderTimeout = setTimeout(() => { this.setState({ firstRender: false }) }, 60) } @@ -45,6 +44,11 @@ export default class Picker extends React.Component { this.handleScroll() } + componentWillUnmount() { + clearTimeout(this.leaveTimeout) + clearTimeout(this.firstRenderTimeout) + } + testStickyPosition() { var stickyTestElement = document.createElement('div') for (let prefix of ['', '-webkit-', '-ms-', '-moz-', '-o-']) {