Below code is not showing displayalert on popuppage in iOS.
In android it is working properly.
I am using Mopups.Pages.PopupPage
I am using mvvm.
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage
xmlns:pages="clr-namespace:Mopups.Pages;assembly=Mopups"
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:ffimage="clr-namespace:FFImageLoading.Maui;assembly=FFImageLoading.Maui"
xmlns:FFImgLoad="clr-namespace:FFImageLoading.Maui;assembly=FFImageLoading.Maui"
x:Class="Gaibo.Pages.CostPopupPage"
BackgroundColor="#80000000"
>
<pages:PopupPage.Animation>
<animations:ScaleAnimation
PositionIn="Center"
PositionOut="Center"
ScaleIn=".7"
ScaleOut="0.7"
EasingIn="Linear"/>
</pages:PopupPage.Animation>
<StackLayout HorizontalOptions="CenterAndExpand" Margin="10"
VerticalOptions="CenterAndExpand">
<Button Grid.Row="3" CornerRadius="20" Padding="0" Text="Submit" VerticalOptions="CenterAndExpand" HeightRequest="45" Style="{StaticResource AllSubmitBtnStyle}" Command="{Binding SubmitCostCommand}"/>
</StackLayout>
</pages:PopupPage>
code for SubmitCostCommand command
public class CampaignDetailsViewModel
{
private async Task SubmitCostCommandClicked()
{
await App.Current.MainPage.DisplayAlert("", " Thank you for submitting Post Social Link/s.", "Ok");
}
}
in cs file
public CostPopupPage (CampaignDetailslstData CampaignData)
{
InitializeComponent();
var vm = new CampaignDetailsViewModel();
}
This is known issue with Mopups. In order to display your alert on top of a mopup, you need to invoke the alert from mopup page itself, not from Mainpage.
private async Task SubmitCostCommandClicked()
{
var topPage = Mopups.Services.MopupService.Instance.PopupStack[^1];
await topPage.DisplayAlert("Confirm", "Are you sure you want to cancel?", "Yes", "No")
}