Rg.Plugins.Popup: sometimes popup doesn't close well

Hi rotorgames,

I’m using below environment xamarin forms version: 2.3.3.180 rg pop up version: 1.0.4

I’m using this pop up to show loading page. I’m creating 1 page inherited to PopupPage. Please find below code.

public partial class LoadingPopupPage : PopupPage
    {        
        public LoadingPopupPage()
        {
            ActivityIndicator indicator = new ActivityIndicator
            {
                Color = Color.White,
                IsRunning = true,
                IsEnabled = true,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                HeightRequest = 70,
                WidthRequest = 70
            };
            var popupframe = new Frame
            {
                Padding = new Thickness (1.0)                   
            };
            var popupstacklayout = new StackLayout
            {
                Children =
                {
                    indicator,
                    new Label
                    {
                        Text = "Please Wait",
                        TextColor = Color.White
                    }
                }
            };
            popupstacklayout.VerticalOptions = LayoutOptions.Center;
            popupstacklayout.HorizontalOptions = LayoutOptions.Center;            
            popupstacklayout.Padding = new Thickness(40, 20);
                                    
            Content = popupstacklayout;            
        }

        public async void closepupup()
        {            await Navigation.PopPopupAsync();
            await Navigation.RemovePopupPageAsync(this);
        }

I called this page from my webview page.

private void webview_navigated(object sender, WebNavigatedEventArgs e)
        {            
            webloadingpage.closepupup();         
        }

        private async void webview_navigating(object sender, WebNavigatingEventArgs e)
        {            
            webloadingpage = new LoadingPopupPage();
            await Navigation.PushPopupAsync(webloadingpage);

        }

Sometimes when it hits the webview_navigated (I debug and it hits the webloadingpage.closepopup() line), the close popup process could not close the popup well. Please advise

Best Regards, Afin

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

@EmilAlipiev Are you sure that you closed the popup page which was opened? ‘webview_navigating’ could be invoked repeatedly. Then the ‘webloadingpage’ could be changed and you could close the other page. I recommend to use the ‘RemovePopupPageAsync’ only if you want to close page in center of the ‘PopupStack’.

‘PopPopupAsync’ will close last page in the ‘PopupStack’ if it contains any pages.

‘RemovePopupPageAsunc’ will close a page which you will add in the first parameter.