twobin / twobin/react-lazyload

Load not work when parent element has display: none;

Open
#307 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
485
PR merge metrics
No merged PRs in 30d

Description

When I have a `` inside an element with `display: none` and I change this display to block, the content not load. This content only will load after a scroll interaction.

The code is like that:

```js
export default function App() {
const [tab, setTab] = useState(1);

return (




  • setTab(1)}>tab 1


  • setTab(2)}>tab 2



Content of tab 1



1



Content of tab 2



2




);
}
```

The problem is that:

![Screen Recording 2020-06-12 at 07 07 PM](https://user-images.githubusercontent.com/3240670/84550126-1567d700-ace0-11ea-9fe6-581de566a3ce.gif)

And the complete code is here:

https://codesandbox.io/s/determined-hoover-z6cff?file=/src/App.js:104-960

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.