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.

prop for rendering responsive wrapper even if height and width are 0

See original GitHub issue

Is your feature request related to a problem? Please describe.

I’m wanting to write a functional test that requests some data from an API and then asserts some amount of bars are present.

Currently, my tests show <div style='height: 100%; width: 100%'></div> instead of <div>...some svg that I can query on here</div>

I’ve narrowed it down to this line: https://github.com/plouc/nivo/blob/cf0fd6bdaacd36edfacbb951a036de19ce374aae/packages/core/src/components/ResponsiveWrapper.js#L28

Describe the solution you’d like A clear and concise description of what you want to happen.

I would love to be able to pass a prop to a ResponsiveWrapper, like:

<ResponsiveLine alwaysRender={true} {...props} />

and then inside of ResponsiveWrapper:

(shouldRender || this.props.alwaysRender) && {this.props.children}

Describe alternatives you’ve considered I considered just writing my own responsive wrapper that basically copies your implementation, but omits the shouldRender && and just always renders the children.

Additional context

I’m interested in sending in a PR for this but wanted to see if you’re interested in this before I do that 😃 thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10

github_iconTop GitHub Comments

4reactions
jhbalestrincommented, Nov 24, 2020

+1 for this, i’m on the same issue here.

2reactions
ErikGMatoscommented, Jun 17, 2022

I’m came back, now to tell you that for me worked like a charm. I going to leave here the example of my code. Thank you @russmatney for help me.

https://gist.github.com/ErikGMatos/20192d0ee2815a14e8516c16002c6422

https://user-images.githubusercontent.com/29432413/174338237-848d4003-5b37-4cf0-aef4-2b9a645b0e0e.mov

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get a react component's size (height/width) before ...
When you call $('#container').width() , you are querying the width of an element that has rendered in the DOM. Even in jQuery you...
Read more >
Developing responsive layouts with React Hooks
Initial implementation using Hooks​​ Now whenever the window is resized the width state variable is updated to equal the new viewport width, and ......
Read more >
Keep it contained!. Enforcing an aspect ratio on an HTML…
All we have to do is divide the height of our aspect ratio by its width, ... .aspect-ratio__inner-wrapper { position: absolute; top: 0;...
Read more >
Implement responsive aspect ratio on window resize with ...
We select the iframe element from the DOM and get its rendered width with getBoundingClientRect().width . We calculate the height using the ...
Read more >
Fluid Width Video
IN A WORLD of responsive and fluid layouts on the web, ONE MEDIA TYPE ... maybe even super old school --> <object width="400"...
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