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

Fix Issue #1238 #1249

Merged
merged 2 commits into from
Jun 15, 2023
Merged

Fix Issue #1238 #1249

merged 2 commits into from
Jun 15, 2023

Conversation

cat0363
Copy link
Contributor

@cat0363 cat0363 commented Jun 15, 2023

If you rotate the screen while the Popup is displayed, the Popup will be displayed
in an unintended position. This PR ensures that the popup appears in the correct
position after screen rotation.

Description of Change

This issue was resolved by overriding MauiPopup's ViewWilTransitionToSize method and
calling the PopupExtension's SetSize and SetLayout methods after rotation.
Because the anchor is not set again after screen rotation. By setting this anchor again,
the Popup will be displayed at the intended location.

[MauiPopup.macios.cs]

public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
    coordinator.AnimateAlongsideTransition((IUIViewControllerTransitionCoordinatorContext obj) => {			
        // Before screen rotate
    }, (IUIViewControllerTransitionCoordinatorContext obj) => {
        // After screen rotate
        if (VirtualView is not null)
        {
            PopupExtensions.SetSize(this, VirtualView);
            PopupExtensions.SetLayout(this, VirtualView);
        }
    });
    base.ViewWillTransitionToSize(toSize, coordinator);
}

Linked Issues

PR Checklist

Additional information

Below is the execution result.

When Requires full request in info.plist is OFF.

[iOS 13.7]

iPad.7th.generation.iOS.13.7.2023-06-14.13-56-07.mp4

[iOS 14.5]

iPad.8th.generation.iOS.14.5.2023-06-14.13-41-18.mp4

[iOS 15.5]

iPad.9th.generation.iOS.15.5.2023-06-14.13-33-06.mp4

[iOS 16.4]

iPad.10th.generation.iOS.16.4.2023-06-14.13-26-39.mp4

When Requires full request in info.plist is ON.

[iOS 13.7]

iPad.7th.generation.iOS.13.7.2023-06-14.14-07-43.mp4

[iOS 14.5]

iPad.8th.generation.iOS.14.5.2023-06-14.14-25-09.mp4

[iOS 15.5]

iPad.9th.generation.iOS.15.5.2023-06-14.14-27-53.mp4

[iOS 16.4]

iPad.10th.generation.iOS.16.4.2023-06-14.14-30-15.mp4

By applying this solution, the position of the popup after screen rotation became as intended.

@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) June 15, 2023 12:27
@VladislavAntonyuk VladislavAntonyuk merged commit 4d95cf8 into CommunityToolkit:main Jun 15, 2023
7 checks passed
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

Successfully merging this pull request may close these issues.

[BUG] Popup is not displayed in the intended position when the terminal is rotated on iOS.
2 participants