@@ -116,13 +116,12 @@ export default class Resizable extends React.Component<Props, State> {
116116 prevClient : [ null , null ]
117117 } ;
118118
119- UNSAFE_componentWillReceiveProps ( nextProps : Object ) {
119+ componentDidUpdate ( prevProps : Object ) {
120120 // If parent changes height/width, set that in our state.
121- if ( ! this . state . resizing &&
122- ( nextProps . width !== this . props . width || nextProps . height !== this . props . height ) ) {
121+ if ( ! this . state . resizing && ( prevProps . width !== this . props . width || prevProps . height !== this . props . height ) ) {
123122 this . setState ( {
124- width : nextProps . width ,
125- height : nextProps . height
123+ width : this . props . width ,
124+ height : this . props . height
126125 } ) ;
127126 }
128127 }
@@ -200,7 +199,7 @@ export default class Resizable extends React.Component<Props, State> {
200199 }
201200 const { prevClient } = this . state ;
202201
203- // Calculate true deltas, this is needed to fix an issue with react-draggable not providing
202+ // Calculate true deltas, this is needed to fix an issue with react-draggable not providing
204203 // correct deltas on move
205204 deltaX = prevClient [ 0 ] ? ( inverted ? prevClient [ 0 ] - clientX : clientX - prevClient [ 0 ] ) : deltaX ;
206205 deltaY = prevClient [ 1 ] ? clientY - prevClient [ 1 ] : deltaY ;
@@ -230,7 +229,7 @@ export default class Resizable extends React.Component<Props, State> {
230229 if ( width === this . state . width && height === this . state . height ) return ;
231230 newState . width = width ;
232231 newState . height = height ;
233-
232+
234233 // record client for next iteration
235234 newState . prevClient = [ clientX , clientY ] ;
236235 }
0 commit comments