react-rnd icon indicating copy to clipboard operation
react-rnd copied to clipboard

Is there a way to update bounds when client bounding of the parent changed?

Open fridaythx opened this issue 4 years ago • 1 comments

The bounds dosent't update when client bounding of the parent changed

I'm using react-rnd version [10.3.4]

My browser is: Chrome 93.0.4577.82

I am sure this issue is not a duplicate? Not sure, but it seems that there is no fix yet for this type of issues at this moment.

Reproduced project

https://codesandbox.io/s/epic-sun-59yzv?file=/src/index.js

Description

As mentioned above

Steps to Reproduce

  1. Click Change button.
  2. You can see that the Rnd block goes out of the bounds.
  3. Drag the Rnd block, the Rnd block goes into the bounds again as you started dragging.

Expected behavior

The bounds should be updated automatically when client bounding of the parent changed, or providing a instance method to update the bounds from outside of Rnd just like updateSize and updatePosition

Actual behavior

Rnd just goes out of the bounds when client bounding of the parent changed, even though it should not be. Also Rnd has no API or some other way for updating bounds from outside.

fridaythx avatar Sep 25 '21 07:09 fridaythx

As a temporary fix I have directly updated the props being passed to the draggable. The props can be accessed through the draggable ref. image

anudeepreddy avatar Oct 19 '22 13:10 anudeepreddy