twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 forks source link

Placeholder is not working. #320

Open AxeemHaider opened 4 years ago

AxeemHaider commented 4 years ago

If I set any placeholder it will not work.

Here is an example.

<LazyLoad
        placeholder={<ReactLoading/>}
        height={180}
      >
        <img
          src={tile.src}
          alt={tile.title}
          onClick={() => props.onClick(imageIndex, tile.id)}
        />
      </LazyLoad>

RectLoading returns <Skeleton variant="rect" width={210} height={118} /> from material-ui

I also try to add some text but nothing to show.

<LazyLoad
        placeholder={<Typography variant="h1">Placeholder</Typography>}
        height={180}

     .... other code

can you please look at this issue

kyoungholee commented 5 months ago

` <LazyLoad placeholder={ div

Placeholder
/div}

height={180}

How about modifying the code in this way?

`

It's in the placeholder

Placeholder Try wrapping it in div before the code starts.