Skip to content
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

Pass height state into the onOpen, onOpening and other methods #215

Open
emad-ms opened this issue Jan 5, 2022 · 0 comments
Open

Pass height state into the onOpen, onOpening and other methods #215

emad-ms opened this issue Jan 5, 2022 · 0 comments

Comments

@emad-ms
Copy link

emad-ms commented Jan 5, 2022

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,
     })
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant