diff --git a/index.js b/index.js index ad60eccd..86bf87de 100644 --- a/index.js +++ b/index.js @@ -117,7 +117,7 @@ export default class Drawer extends Component { this._childDrawer = drawer } - componentWillMount() { + componentDidMount() { if (this.context.drawer) this.context.drawer._registerChildDrawer(this) if (this.props.openDrawerThreshold && process.env.NODE_ENV !== 'production') console.error('react-native-drawer: openDrawerThreshold is obsolete. Use panThreshold instead.') if (this.props.panStartCompensation && process.env.NODE_ENV !== 'production') console.error('react-native-drawer: panStartCompensation is deprecated.') @@ -125,16 +125,14 @@ export default class Drawer extends Component { this.initialize(this.props) } - componentWillReceiveProps(nextProps) { - if (this.requiresResync(nextProps)) this.resync(null, nextProps) + componentDidUpdate() { + if (this.requiresResync(this.props)) this.resync(null, this.props) - if (nextProps.open !== null && this._open !== nextProps.open) { + if (this.props.open !== null && this._open !== this.props.open) { this._syncAfterUpdate = true - this._open = nextProps.open + this._open = this.props.open } - } - componentDidUpdate() { if (this._syncAfterUpdate) { this._syncAfterUpdate = false this._open ? this.open('force') : this.close('force')