dvtng / react-loading-skeleton

Create skeleton screens that automatically adapt to your app!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`hidden` prop does not work

oren-l opened this issue · comments

commented

Describe the bug
hidden prop should be forwarded to the element being rendered

To Reproduce
use hidden prop like so: <Skeleton width={100} height={100} hidden />
example: https://codesandbox.io/p/sandbox/hardcore-goldberg-jgcn7f?file=%2Fsrc%2FApp.js%3A8%2C5

Actual Behavior
a span element is rendered as the component root element. this element has no hidden attribute

Expected Behavior
a span element is rendered as the component root element. this element has hidden attribute

Versions

  • react-loading-skeleton version: 3.4.0
  • Browser version: google chrome Version 122.0.6261.94 (Official Build) (x86_64)

The Skeleton component does not forward its props to the underlying DOM element (<span>).

If you want to hide the Skeleton, you could (a) not render the Skeleton in the first place, or (b) use the containerClassName prop to set display: none with CSS. Hope that helps.