Pass height state into the onOpen, onOpening and other methods
emad-ms opened this issue · comments
emad-ms commented
Feature request
Since react-collapsible is calculating the scrollHeight
of its children it can pass it through methods like onOpen
, or onOpening
to let the parent component be aware of that too.
This can be really helpful when height and positioning in parent component matters and developer needs to know the content height without using DOM selectors.
For example for onOpen
:
this.setState(({ height: prevHeight }) => {
this.props.onOpen({ height: prevHeight }); // or even just pass it using innerRef.scrollHeight
return ({
height: 'auto',
overflow: this.props.overflowWhenOpen,
inTransition: false,
})
});