rotorgames / Rg.Plugins.Popup

Xamarin Forms popup plugin
MIT License
1.15k stars 336 forks source link

SystemPadding incorrect on iOS #553

Open OABsoftware opened 4 years ago

OABsoftware commented 4 years ago

🐛 Bug Report

On iOS the SystemPadding values are not correct. When the device is in the portrait orientation, the SystemPadding.Top is correct, but the SystemPadding.Bottom is 0. On my iPhone 10 that should be 34, because of the safe area inset.

This could be solved by adding the something like this to the PopupPageRenderer for iOS:

    public override void ViewSafeAreaInsetsDidChange()
    {
        base.ViewSafeAreaInsetsDidChange();

        if (this.Element != null && this.NativeView != null)
        {
            ActionSheet pagActionSheet = Element as ActionSheet;
            UIEdgeInsets tSafeAreaInsets = this.NativeView.SafeAreaInsets;
            currentElement.SystemPadding = new Thickness(tSafeAreaInsets.Left, tSafeAreaInsets.Top, tSafeAreaInsets.Right, tSafeAreaInsets.Bottom);
        }
    }

Platform:

martijn00 commented 3 years ago

Can you make a PR?