[BUG] Plugin.Popups.Maui on iOS navigate to new page when showing popup Page
albilaga opened this issue · comments
Description
When using NavigationService.NavigateAsync(nameof(PopupPage))
in iOS it will be shown in new page instead of current page. I also doubt this is issue on Mopups because using MopupService.Instance.PushAsync(new PopupPage())
is working fine. On Android this is working fine
Steps to Reproduce
- Open this project https://github.com/albilaga/PrismPopupsIssue
- Run the project on iOS
- It will show new page when using prism
NavigationService
Platform with bug
.NET MAUI
Affected platforms
iOS
Did you find any workaround?
Not yet found workaround
Relevant log output
No response
I am seeing the same behavior on iOS
Sorry. Looks like I am missing Popups need to rearchitect to use IDialogService. I am already using IDialogService
as you can see in here but now because RegisterDialog forced to accept View instead of MopupsPage now it seems I can't pass animation or also make the dialog to become full screen and then put my popup to anywhere (example is to put it at the bottom of the page or let's say I want the page behind the dialog to be little dark). Is this the expected @dansiegel or is there any other way to do this? Should I make this as new issue? Thank you
Actually I announced several years ago that you should migrate away from Page based Navigation with Popups to Dialogs. It was always scheduled for v9.0 to completely remove that support.
As far as Popup specific properties you can generally either set them with the attached properties from either the DialogLayout or PopupDialogLayout as shown below
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="http://prismlibrary.com"
xmlns:animation="clr-namespace:Mopups.Animations;assembly=Mopups"
prism:DialogLayout.CloseOnBackgroundTapped="False"
prism:PopupDialogLayout.HasSystemPadding="False"
x:Class="MauiApp2.MyDialog">
<prism:PopupDialogLayout.Animation>
<animation:MoveAnimation PositionIn="Top" PositionOut="Bottom" />
</prism:PopupDialogLayout.Animation>
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentView>
Thank you @dansiegel . Attached properties working fine. But CloseOnBackgroundTapped
do nothing and also how to make this view to be fullscreen. Let's say I want it to be something like this
<ContentView
x:Class="PrismPopupsIssue.PopupView"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:animations="clr-namespace:Mopups.Animations;assembly=Mopups"
xmlns:prismPopupsIssue="clr-namespace:PrismPopupsIssue"
xmlns:xaml="http://prismlibrary.com"
Padding="40"
x:DataType="prismPopupsIssue:PopupViewModel"
xaml:DialogLayout.CloseOnBackgroundTapped="True"
xaml:PopupDialogLayout.HasSystemPadding="False"
BackgroundColor="#80000000"
HorizontalOptions="Fill"
VerticalOptions="Fill">
<xaml:PopupDialogLayout.Animation>
<animations:MoveAnimation PositionIn="Top" PositionOut="Bottom" />
</xaml:PopupDialogLayout.Animation>
<VerticalStackLayout
BackgroundColor="White"
Spacing="8"
VerticalOptions="Center">
<Label
FontAttributes="Bold"
FontSize="Header"
HorizontalOptions="Center"
Text="Hello from popup page" />
<Button
Command="{Binding GoBackCommand, Mode=OneTime}"
HorizontalOptions="Center"
Text="Go Back" />
</VerticalStackLayout>
</ContentView>
so the whole page will have little dark background and only my VerticalStackLayout
will have focus white like what Mopups do?
Seems I missed the memo also.
After setting up with Dialogs as described I am unable to get a background click to dismiss dialog (in iOS). I tried both methods of the attached property @dansiegel shows and doing in the navigate like @albilaga did in the related project
@ramtechjoe please open an issue for the issue you're having with the Dismiss on Background Tapped so we can track that appropriately.
@dansiegel I added the new issue in here #3168
@albilaga Thanks for opening the new issue
@albilaga do you have any issues with the attached PopupDialogLayout? I cannot get things to compile when I have in my Xaml. Keep getting
XFC0000 Cannot resolve type "http://prismlibrary.com:PopupDialogLayout"
Weird thing is the intellisense shows up, so it at least in VS it seems like it sees it. But then won't compile
@ramtechjoe nope. This is working on my machine https://github.com/albilaga/PrismPopupsIssue/blob/main/PrismPopupsIssue/PopupView.xaml#L17 ( I am using rider)