diff --git a/__test__/BlockUi.spec.js b/__test__/BlockUi.spec.js index b72e07b..afdca90 100644 --- a/__test__/BlockUi.spec.js +++ b/__test__/BlockUi.spec.js @@ -409,7 +409,7 @@ describe('BlockUi', function() { const instance = wrapper.instance(); instance.helper = { parentNode: { contains: sinon.stub().returns(true) } }; wrapper.find('input').simulate('click'); - instance.componentWillReceiveProps({ blocking: true }); + instance.UNSAFE_componentWillReceiveProps({ blocking: true }); expect(instance.focused).to.equal(document.activeElement); expect(instance.helper.parentNode.contains).to.have.been.called; }); @@ -419,7 +419,7 @@ describe('BlockUi', function() { const wrapper = shallow(); const instance = wrapper.instance(); sinon.spy(window, 'addEventListener'); - instance.componentWillReceiveProps({ blocking: true, keepInView: true }); + instance.UNSAFE_componentWillReceiveProps({ blocking: true, keepInView: true }); expect(window.addEventListener).to.have.been.calledWith('scroll', instance.handleScroll); window.addEventListener.restore(); }); @@ -431,7 +431,7 @@ describe('BlockUi', function() { const wrapper = shallow(); const instance = wrapper.instance(); sinon.spy(window, 'addEventListener'); - instance.componentWillReceiveProps({ blocking: true, keepInView: true }); + instance.UNSAFE_componentWillReceiveProps({ blocking: true, keepInView: true }); expect(window.addEventListener).to.have.been.calledWith('scroll', instance.handleScroll); window.addEventListener.restore(); }); @@ -444,7 +444,7 @@ describe('BlockUi', function() { const instance = wrapper.instance(); const spy = sinon.spy(); instance.focused = { focus: spy }; - instance.componentWillReceiveProps({ blocking: false }); + instance.UNSAFE_componentWillReceiveProps({ blocking: false }); expect(spy).to.have.been.called; }); }); @@ -453,7 +453,7 @@ describe('BlockUi', function() { const wrapper = shallow(); const instance = wrapper.instance(); instance.focused = null; - expect(instance.componentWillReceiveProps.bind(instance, { blocking: false })).to.not.throw; + expect(instance.UNSAFE_componentWillReceiveProps.bind(instance, { blocking: false })).to.not.throw; }); }); describe('keepInView', () => { @@ -461,7 +461,7 @@ describe('BlockUi', function() { const wrapper = shallow(); const instance = wrapper.instance(); sinon.spy(window, 'removeEventListener'); - instance.componentWillReceiveProps({ blocking: false }); + instance.UNSAFE_componentWillReceiveProps({ blocking: false }); expect(window.removeEventListener).to.have.been.calledWith('scroll', instance.handleScroll); window.removeEventListener.restore(); }); diff --git a/src/BlockUi.js b/src/BlockUi.js index 732a8a4..01b72b4 100644 --- a/src/BlockUi.js +++ b/src/BlockUi.js @@ -28,7 +28,7 @@ class BlockUi extends Component { } - componentWillReceiveProps(nextProps) { + UNSAFE_componentWillReceiveProps(nextProps) { if (nextProps.blocking !== this.props.blocking) { if (nextProps.blocking) { // blocking started diff --git a/src/ReduxBlockUi.js b/src/ReduxBlockUi.js index 655609c..84bde9a 100644 --- a/src/ReduxBlockUi.js +++ b/src/ReduxBlockUi.js @@ -15,7 +15,7 @@ class ReduxBlockUi extends Component { }; } - componentWillMount() { + UNSAFE_componentWillMount() { register(this.middleware); }