Comments (4)
Hey @MadsFrost, so sorry to hear you're facing such an issue.
Could you please paste here the snippet of what you're trying to do? And what is the visual result you want?
Thanks
from react-content-loader.
Hi @danilowoz, thanks for the swift reply.
I made a custom component for text, which just wraps any type of label/link with some default styles, forgive my awful recreation/explanation, but I want to somehow adapt the width and height to the size of that element (inferring dimensions - see attachment below code), right now it's a static width/height:
<div>
<ContentLoader style={{ marginBottom: 5 }} width={'100%'} height={'20'}>
<rect x='0' y='0' rx='9' ry='15' width={'100%'} height={'20'} />
</ContentLoader>
</div>
A visual example of what I am interested in is how MUI-UI handles this problem. Is there any equivalent using React Content Loader :)?
I'm quite new to content loaders as well as TypeScript, but I am sure there must be somewhat of a use case for this in React Content Loader.
P.s, thank you for the awesome library, life-saver!
EDIT: Somewhat of a duplicate issue I believe, but can't find any resolutions: #123
from react-content-loader.
@danilowoz Any ideas to what could be done? It's unfortunately still an issue trying to get responsive skeleton sizes based on content.
from react-content-loader.
Hey @MadsFrost, here's an example of a responsive component: https://codesandbox.io/s/responsive-bf9qr
An SVG element needs a viewBox
attribute to understand its ratio, and it should do the trick.
Unfortunately, rect
doesn't support percentage values, so my suggestion is to use specific units (px) and then resize the SVG element with its proper viewBox
.
Hope it solves your issue :D
from react-content-loader.
Related Issues (20)
- RN: ContentLoader backgroundColor and foregroundColor not working with PlatformColor HOT 2
- How about supporting extra prop for outlined shape HOT 2
- Example links in readme are dead HOT 1
- seem to not work on stroke base svg HOT 1
- Using backspace in the editor deletes element even when editing values outside of the canvas area HOT 1
- Rect fill color doesn't work HOT 1
- Animation is not working in React Native with react-native-svg >= 13.0.0 HOT 7
- Vue.JS 3 Support HOT 1
- SVG: Support for defaultProps will be removed from function components HOT 3
- next.js report React Hydration Error HOT 2
- Attempt to invoke virtual method double java.lang.double.doublevalue() on a null object reference HOT 14
- An SVG can't be converted
- Vertical Alignment of SVGs inside of ContentLoader in React Native HOT 1
- Not possible to remove title HOT 1
- Different forgroundColor for one of the Rect
- TS error on React Native when using compilerOptions.moduleSuffixes HOT 2
- WEBSITE GENERATOR: When editing size of active element property ex. width, the whole canvas disappears HOT 1
- synchronize multiple skeleton loading
- Invariant Violation: Unable to locate attached view in the native tree
- Skeletons animations are not working in the latest Chrome version HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-content-loader.