react-grid-layout / react-resizable

A simple React component that is resizable with a handle.

Home Page:https://strml.github.io/react-resizable/examples/1.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong `offsetParent` `propType`

hejtful opened this issue · comments

Thanks for opening an issue!

Please select the type of issue you're reporting. For questions.

  • Bug
  • Feature Request
  • Question

Problem Report

react-draggable expects the property offsetParent to be an HTMLElement (relevant line in react-draggable source code)

react-resizable has the propType of offsetParent set to PropTypes.node, so when an HTML Element is passed, an error is printed in the console:
Warning: Failed prop type: Invalid prop `draggableOpts.offsetParent` supplied to `Resizable`, expected a ReactNode.

Note: The offsetParent property is important because of this issue and this fix/workaround of that issue.

Reproduction

https://codesandbox.io/s/react-resizable-playground-forked-c673dc?file=/src/index.js

Note: The Codesandbox link of the issue template had an old version of react-resizable, so I first updated it, and then added the offsetParent property.