ctrlplusb / react-sizeme

Make your React Components aware of their width and height!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HOC onSize callback alternative usage example not working

modemmute opened this issue · comments

The example presented in the "HOC Usage" / "'onSize' callback alternative usage" is not working.

https://codesandbox.io/s/react-sizeme-test-8wooy

The returned object only contains a value for the width. The height and position are null. Or am I doing something wrong? I tried downgrading the React & React-DOM version back down to 16.8 with the same results. Any help appreciated!

You need to add monitorHeight to the configuration options.

sizeMe({ monitorHeight: true })(Component);

The position is never tracked. Sorry that is an artifact from a failed experiment.