bootstarted / react-resize-observer Goto Github PK
View Code? Open in Web Editor NEWComponent for giving you `onResize`.
License: MIT License
Component for giving you `onResize`.
License: MIT License
Apologies if someone has brought this up before. I'm using react-resize-observer
in a way where I need it to live inside elements like <p>
and <span>
sometimes.
But React complains about this since it's against the HTML spec:
index.js:2178 Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
It seems like the same functionality could be done with span
as long as it's set to display: block
. AFAIK spans are valid everywhere. Would it be worthwhile to switch?
I'm trying to implement breakpoints like this article:
https://philipwalton.com/articles/responsive-components-a-solution-to-the-container-queries-problem/#observing-container-resizes
Essentially I want the parentNode object to have classes like .SM .MD .LG depending on how big they are. The problem is accessing either the parentNode or embedding content in the children of the . Neither are easy.
The resize and reflow, only return the rect, which is great, but they could easily return the parentNode as well. This would make it much more useful in this usecase. If you embed content as children like <ResizeObserver>{children}</ResizeObserver>
then the content isn't passed through.
In the version I'm running locally, I just extend the reflow, resize, position to also return the parentNode. would you guys be open to me creating a PR to extend it to return parentNode as well?
Hi, I'm trying to use this module with rollup, the problem is that while compiling it trigger the error: [!] Error: 'ResizeObserver' is not exported by ....\node_modules\react-resize-observer\lib\ResizeObserver.js
Actually i've found that using the default export ResizeObserver inside node_modules/react-resize-observer/lib/ResizeObserver.js
Solve the problem, but I really don't wanto to have to do this. I've read the rollup documentation and in similar cases you must create a namedExport inside your rollup config file (ie this is necessary with some react stuff), but in this case it doesn't seems to work.
Have you any info or suggestion to have this working on rollup? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.