dvtng / react-loading-skeleton

Create skeleton screens that automatically adapt to your app!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inline is not removing br

Hainesy opened this issue · comments

Describe the bug
The inline property makes no difference as to whether a <br /> tag is being rendered.

To Reproduce

<SkeletonTheme baseColor={color} highlightColor={highlightColor}>
    <Skeleton
      inline
      height={height}
      width={width}
      style={{ display: 'block', borderRadius, aspectRatio, lineHeight: 1 }}
    />
  </SkeletonTheme>

Actual Behavior
A <br /> tag was rendered

Expected Behavior
No <br /> tag should be rendered

Versions

  • react-loading-skeleton version: 3.3.1
  • Browser version: N/A

Hi @Hainesy, looking at the code, it appears that <br /> is only rendered when inline is false.

if (inline) {
elements.push(skeletonSpan);
} else {
// Without the <br />, the skeleton lines will all run together if
// `width` is specified
elements.push(
<React.Fragment key={i}>
{skeletonSpan}
<br />
</React.Fragment>
);
}
}

Maybe the issue is that you set display: block in the style prop.

If you still think there is a bug, please submit a runnable example that shows the problem. Thanks.