ctrlplusb / react-sizeme

Make your React Components aware of their width and height!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FirstTime render will flicker once in react.Component

catXiaoXiao opened this issue · comments

please handle this problem,thanks.
"react": "^16.2.0"

You can't avoid the flicker. That is caused by how react-sizeme in combination with react works. In order to know about the height of the parent element, the parent element needs to be rendered first without the child. Once the parent is rendered the child can know about it's parent dimensions and be rendered with the dimensions injected.

@catXiaoXiao you can pass the option to disable the placeholder (via noPlaceholder). This will ensure your actual component is rendered. However, the size values will be null until your component is measured. So you will have to account for this.