Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly in doc that Size children must be an HTML element #153

Open
keul opened this issue Sep 7, 2018 · 1 comment
Open

Explicitly in doc that Size children must be an HTML element #153

keul opened this issue Sep 7, 2018 · 1 comment

Comments

@keul
Copy link

keul commented Sep 7, 2018

After a refactoring I found that react-sizeme was not working properly anymore; my size.width was 0.

This was my original call (I don't think the HOC version is important): sizeMe()(App)

The issue in the end was the composition of my App component: before the code change the main element was a div, while after that div is wrapped inside the the style-components's StyleSheetManager and a Fragment.

The fix was easy:

    return (
      <StyleSheetManager target={element}>
        <Fragment>
          <OtherStuff />
          <SizeMe>
            {({ size }) => (
               <div>...

If I'm right, my suggestion is to improve the documentation by explicitly report this behavior.

@kaitmore
Copy link

I experienced a similar issue. I was using <React.Fragment> as a direct child of <SizeMe> which caused an infinite loop in my application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants