-
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect positioning when component becomes controlled in React 18 #910
Comments
Same here! Storing position in IndexedDB, when restoring it's not positioning correctly. |
Same here!How should I solve this problem |
I had similar issues this repo is basically unmantained at this point - I forked it here https://github.com/dan-cooke/react-redrag And made the following changes The problem lines are https://github.com/bokuweb/react-rnd/pull/920/files#diff-0b5adbfe7b36e4ae2f479291e20152e33e940f7f265162d77f40f6bdb5da7405L242-L248 Where the component will always update the inital state value by applying the parent offset delta.. this may or may not be the correct thing to do. But I have removed it and its working as intended for my use case now. ie. I can set Feel free to pull my changes - I may release Realistically this repo is just a wrapper around |
Overview of the problem
I'm using react-rnd version [10.4.1]
react, react-dom version: 18.2.0
My browser is: Chrome Version 115.0.5790.170 (Official Build) (arm64)
Reproduced project
https://codesandbox.io/s/naughty-shape-hz4t3r
Description
I store the position of RnD element in the redux store. But when I pass the stored value back to the component the positioning doesn't work properly(see the codesandbox)
Same happens if you try to store the position to the react state
Steps to Reproduce
bounds="parent"
propertyonDrag
event with new positionExpected behavior
The RnD component follows mouse movement
Actual behavior
The RnD component quickly moves to the bottom right corner and stays there
The text was updated successfully, but these errors were encountered: