Do not use deprecated `isMounted`
parent
9eb8f0b6ac
commit
2feae02477
|
@ -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-']) {
|
||||||
|
|
Loading…
Reference in New Issue