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

position prop is not passed sometimes to the render component #98

Open
morewings opened this issue Dec 21, 2020 · 1 comment
Open

position prop is not passed sometimes to the render component #98

morewings opened this issue Dec 21, 2020 · 1 comment

Comments

@morewings
Copy link

morewings commented Dec 21, 2020

I have this code (example is simplified) in my project. After update to 6.0.3, I started to have warnings that position prop is undefined from inside PopoverContent.

<Popover
      align="start"
      isOpen={isVisible}
      position={['bottom', 'top']}
      content={({position}) => (
        <PopoverContent position={position} />
      )}>
      ...
    </Popover>
@JohannesKaufmann
Copy link

It seems to happen when resizing the window.

Then position, popoverRect.top, popoverRect.left are undefined. And popoverRect.right and popoverRect.bottom are NaN.


Before resize:

bottom 
DOMRect { x: 980, y: 0, width: 354, height: 76, top: 0, right: 1334, bottom: 76, left: 980 }
Object { top: 76, left: 996, width: 322, height: 272, right: 1318, bottom: 348 }

After resize:

undefined 
DOMRect { x: 980, y: 0, width: 354, height: 76, top: 0, right: 1334, bottom: 76, left: 980 }
Object { top: undefined, left: undefined, width: 322, height: 271, right: NaN, bottom: NaN }

great library btw 🙏🎉🤩

Some things could still be improved (like scrolling the popover content when it doesn't fit on the screen). But the library offers enough control to the developers to implement it themself 👍

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