prop for rendering responsive wrapper even if height and width are 0
See original GitHub issueIs 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:
- Created 4 years ago
- Reactions:4
- Comments:10
Top GitHub Comments
+1 for this, i’m on the same issue here.
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