-
Notifications
You must be signed in to change notification settings - Fork 338
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
[BUG] Error using popup on iOS #1844
Comments
Hi @acaliaro. We have added the "needs reproduction" label to this issue, which indicates that we cannot take further action. This issue will be closed automatically in 5 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@brminnick sorry but I am not able to create a repo. The problem appears in a very large app. The information I sent you on the crash seems quite clear and the null check of the object is also punctual. Do you think the change can be made? |
I can't fix the bug if I cannot identify the root cause. I can't identify the root cause without a reproduction. |
@acaliaro how about trying to make that change locally and see if that solves your problem? Then if we can gain confidence it solves the issue your changes could make it into a PR |
@brminnick I am also facing this issue on the iPhone 11 or lower. The iOS version does not matter. Steps to reproduce(1st approach):
Steps to reproduce(2nd approach):
The reason behind the crash is the PresentationController.ContainerView that is being passed in the SetShadowView method is null.
1st approach Demo: 2nd approach Demo: |
As discussed in #1864, I used a simple Hint: I used iPhone with latest iOS and currently 17.2 <?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:loc="clr-namespace:LocalizationResourceManager.Maui;assembly=LocalizationResourceManager.Maui"
xmlns:toolkit="clr-namespace:CommunityToolkit.Maui.Views;assembly=CommunityToolkit.Maui"
x:Class="OptimizerApp.Pages.Views.Controls.CustomActivityIndicator.CustomCalculationActivityIndicator"
CanBeDismissedByTappingOutsideOfPopup="False">
<VerticalStackLayout Background="White">
<!-- Inner StackLayout needed to have an easy nice border with the Margin -->
<VerticalStackLayout Background="White" Margin="30" HorizontalOptions="Center" VerticalOptions="Center">
<ActivityIndicator IsRunning="True"/>
<Label Text="{loc:Translate ActivityIndicator_CalculatingLabel}" FontSize="13" Margin="0, 10, 0, 0"/>
</VerticalStackLayout>
</VerticalStackLayout>
</toolkit:Popup> using CommunityToolkit.Maui.Views;
namespace OptimizerApp.Pages.Views.Controls.CustomActivityIndicator;
public partial class CustomCalculationActivityIndicator : Popup
{
public CustomCalculationActivityIndicator()
{
InitializeComponent();
}
} And in my var myPopup = new CustomCalculationActivityIndicator();
…
Application.Current?.MainPage?.ShowPopup(myPopup); As I changed to my own implementation of a This resulted in |
I changed the simulator on iOS 17 and verified whether the problem occurred. iPhone 15 : OK This issue occurred in Plus and Pro Max simulators. In addition, in versions earlier than Community Toolkit 8.0.0, the crash does not occur when the device is rotated, but the Popup becomes full screen without the background color becoming transparent. iPhone.12.Pro.Max.iOS.14.5.2024-05-14.16-25-19.mp4By applying PR #1615, the above issue will be resolved on iPhone 12 and later simulators other than Plus and ProMax. Even if you specify Start in the Vertical Options and Horizontal Options of Popup, if you rotate the device orientation, it will be displayed full screen and centered. iPhone.12.Pro.Max.iOS.14.5.2024-05-14.16-42-21.mp4Even if you explicitly specify the Popup position in SourceRect, it will not be reflected if the device orientation is Landscape. [src\CommunityToolkit.Maui.Core\Views\Popup\PopupExtensions.macios.cs]
It is unclear why the position of Popup is not reflected. It is also unclear why the Popup size covers the entire screen when the device orientation is Landscape... We need to resolve a Popup size and position issue that occurs when I change the device orientation to Landscape. Additional Information: |
Thanks for finding that out! I recognize parts of it also in previous Simulator versions or .NET MAUI versions! I also used a Pro Max here. The FullScreen issue in previous versions when rotating is also very familiar to me! |
@MAUIoxo , Thank you for providing the information. |
I have an iPhone 14 Pro Max and I had a crash of my App with this Bug when changing orientation! Also the problem regarding full screen in previous versions is well known to me on a real device |
@MAUIoxo , Thank you for reporting the problem on a real device. |
Well, not bad for me, I created my own Popup with a simple |
I found the solution for this issue. I will create a PR after tomorrow. |
Wow, that was fast - do you want to tell us about the problem you found? |
@MAUIoxo , I just created a PR, so please take a look at it. |
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
I show a popup. When I close the popup, I have an exception
I think the problem is that "target" sometimes is null
maybe a check on "target" and "target.Subviews" should solve the problem...
Expected Behavior
It should not crash
Steps To Reproduce
I have a popup that I Use as loader... when I close the popup after some "works", sometimes the exception is thrown
Link to public reproduction project repository
I haven't one...
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: