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

Resizable has no `ref` in props interface

Open mariopeixoto opened this issue 4 years ago • 2 comments

Thanks for opening an issue!

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

  • [ ] Bug
  • [X] Feature Request
  • [ ] Question

Problem Report

Resizable has no ref in the props interface, so it's impossible to get a hold of the internal element for effects such as calculating dimensions in runtime. It would be nice to have a ref prop included in both Resizable and ResizableBox components and be passed down to the container element.

Example:

import React, {useRef} from 'react'

export default (props) => {
  const ref = useRef()
  <Resizable defaultSize={{width: 650, height: 350}} ref={ref}>
     ...
  </Resizable>
}

mariopeixoto avatar Apr 01 '20 00:04 mariopeixoto

I assume you are passing the child element yourself. Why not attach the ref to that?

import React, {useRef} from 'react'

export default (props) => {
  const ref = useRef()
  <Resizable defaultSize={{width: 650, height: 350}}>
     <div ref={ref}>Some box</div>
  </Resizable>
}

STRML avatar May 11 '20 17:05 STRML

Hello, is this something that is being worked on, or? Because I would love this feature.

sk0le avatar Mar 23 '23 13:03 sk0le