-
Notifications
You must be signed in to change notification settings - Fork 94
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
Popover position off when rotating while popover has accommodated for keyboard #2
Comments
@hannesmcman do you have your view in the popover in a ScrollView? I think it will only limit the height if it is allowed to, which is only when the first child of the popover is a scroll view. |
And are you passing in the button as a view to the popover? Or as a rect? |
@SteffeyDev The view inside the popover is a ScrollView, yes. And we are passing in the button as a view. We were able to resolve this issue by wrapping the Popover itself in a Viewport component, which re-renders its children upon orientation changes. If you are interested in incorporating something similar into the Popover itself, so that it works out of the box, here is the code for the Viewport and here is how we used it to wrap the Popover. |
Ok, it looks like the viewport is just causing a state change on rotation. Does the popover shift at all post-rotation without the viewport? I'm trying to figure out why it works in my test app but not in your app. Are you using react-navigation? |
What should happen is that the popover won't move during rotation, but after the rotation is finished you should see it shift to the new location. I'm wondering if it is just shifting to the wrong place or not shifting at all? |
We are using react-navigation, but didn't follow the steps outlined here to integrate the popover component with react-navigation, as it was unnecessary for our use case. Here are some very pixelated gifs that demonstrate what we're seeing:
|
Perfect, so it looks like the viewport is simply triggering a refresh, which triggers the popover's onLayout and moves to the new location. I just added the dimension change listener and released as 1.0.5, can you test and see if that works? |
Just tested it on v1.0.5 and it didn't fix it.. 😞 Idk why the onLayout callback is not doing its job.. |
@hannesmcman Ok, try it now with 1.0.7! I made a number of fixes to the layout system and am hopeful that an issue I found was the one you are experiencing. |
@hannesmcman I'm curious if 1.0.7 allows you to use the popover without the viewport wrapper, it would be awesome if you could test it out again when you get the chance. |
@SteffeyDev Just tested v1.0.7 without the Viewport wrapper and it works like a charm! :) |
Awesome, great to hear! |
@SteffeyDev Can this be closed? |
Unfortunately not, the original reason for which I opened this issue is still not resolved... I need to work on the rotating while keyboard open bugs. |
If the popover has to shift to accommodate the keyboard, and then the screen is rotated with the popover and keyboard still open, the popover tends to get confused about where it should be. Need to investigate.
The text was updated successfully, but these errors were encountered: