question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic height content

See original GitHub issue

How I can use react-custom-scrollbars inside my modal what stretch with content? or inside sidebar? Example my modal has dynamic height and width or my sidebar has dynamic height When I’m trying insert scrollable component to another component with dynamic height I have 0px height because content inside react-custom-scrollbars has absolute position Maybe default behavior is stretch height to scrollable height and to limit the height from above component?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:7

github_iconTop GitHub Comments

4reactions
prabuwcommented, Feb 27, 2019

In case, anyone with the same problem arrives here, I created a codesandbox based on @pollen8 comments that demonstrates a solution.

2reactions
pollen8commented, Sep 21, 2018
import React from 'react';
import { Component } from 'react';
import { Scrollbars } from 'react-custom-scrollbars';
import { AutoSizer } from 'react-virtualized';

class Example extends Component {

  render() {
    const { data, selected } = this.props;
    return <div style={{ width: '100%' }}>
    <AutoSizer>
            {({ width, height }) => {
              return (
                <Scrollbars
                  style={{ width, height }}
                >
                  this is your content
                </Scrollbars>
              );
            }
            }
          </AutoSizer>
      }
    </div>;
  }
}

export default Example;

Read more comments on GitHub >

github_iconTop Results From Across the Web

make div's height expand with its content - Stack Overflow
height : auto; causes all the items below to move to the top. With this property on my main content div, the footer...
Read more >
CSS Dynamic Height: Tricks To Improve Your Website's ...
CSS dynamic height makes it easier for people to see your website on any screen. Start reading and learning how to calculate and...
Read more >
How to make div height expand with its content using CSS
The height property is used to set the height of an element. The height property does not contains padding, margin and border of...
Read more >
How to set the height in a CSS to be depending on the content
To set the height of a DIV in CSS, you can simply use the "height: xx" attribute, where xx is the length, in...
Read more >
height - CSS: Cascading Style Sheets - MDN Web Docs
The height CSS property specifies the height of an element. By default, the property defines the height of the content area.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found