Xamarin.Forms
Xamarin.Forms copied to clipboard
[Bug] [iOS] PushModalAsync doesn't push the page passed as parameter (Shell)
Description
Navigation.PushModalAsync doesn't push anything when toggling the visibility of any of shell FlyoutItem.
Steps to Reproduce
In an app using Shell:
- Run the app in a ios device like Iphone 8 Pro Max
- Hide a FlyoutItem by code using his name.
- Push a page using Navigation.PushModalAsync(page)
- Page is not pushed
Using the attached app (an edited version of xaminals):
- Run the app in a ios device like Iphone 8 Pro Max
- Using the flyout go to Page1
- Press the Push modal async page2 button, the page is pushed correctly
- Go back using the button on the bottom
- Tap Hide animals or Show animals
- Press againg the Push modal async page2 button, now the page is not pushed!
Expected Behavior
Page is pushed modally
Actual Behavior
Page is not pushed at all
Basic Information
- Version with issue: 5.0.0.2401
- iOS: 15.5
- NuGet Packages: Xamarin.Forms
Environment
Show/Hide Visual Studio info
Microsoft Visual Studio Community 2022
Versione 17.2.2
VisualStudio.17.Release/17.2.2+32519.379
Microsoft .NET Framework
Versione 4.8.04084
Edizione installata: Community
ASP.NET and Web Tools 2019 17.2.389.42256
ASP.NET and Web Tools 2019
Azure Functions and Web Jobs Tools 17.2.389.42256
Azure Functions and Web Jobs Tools
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Debug di .NET Core con WSL 1.0
Debug di .NET Core con WSL
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Gestione pacchetti NuGet 6.2.0
Gestione pacchetti NuGet in Visual Studio. Per altre informazioni su NuGet, visitare il sito Web https://docs.nuget.org/
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.2.20 (482eb2a)
Support for debugging Mono processes with Visual Studio.
Razor (ASP.NET Core) 17.0.0.2218101+885a343b00bcab620a90c1550c37dafd730ce984
Fornisce servizi di linguaggio per ASP.NET Core Razor.
SQL Server Data Tools 17.0.62204.01010
Microsoft SQL Server Data Tools
Strumenti C# 4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
Componenti di C# usati nell'IDE. A seconda del tipo e delle impostazioni del processo, è possibile che venga usata una versione diversa del compilatore.
Strumenti del Servizio app di Azure versione 3.0.0 17.2.389.42256
Strumenti del Servizio app di Azure versione 3.0.0
Strumenti di Visual Basic 4.2.0-4.22252.24+47cdc16a21bbb8a4aadfb666b011e2059e1be5d2
Componenti di Visual Basic usati nell'IDE. A seconda del tipo e delle impostazioni del processo, è possibile che venga usata una versione diversa del compilatore.
Strumenti TypeScript 17.0.10418.2001
Strumenti TypeScript per Microsoft Visual Studio
Visual F# Tools 17.1.0-beta.22253.3+058e7a7e597a02c129f38742f250a4b212da9ee3
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
Sviluppo assistito conl'intelligenza artificiale per Visual Studio.
VisualStudio.DeviceLog 1.0
Informazioni sul pacchetto
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.2.0.175 (d17-2@e4ffdc0)
Estensione di Visual Studio per consentire lo sviluppo per Xamarin.iOS e Xamarin.Android.
Xamarin Designer 17.2.0.244 (remotes/origin/d17-2@197e1a0b7)
Estensione di Visual Studio per abilitare gli strumenti di Xamarin Designer in Visual Studio.
Xamarin Templates 17.2.15 (2e3b60e)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 12.3.0.3 (d17-2/bbba5a2)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: adf1bc4
Java.Interop: xamarin/java.interop/d17-2@9760f0a9
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.38.2@7b1e016
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac
Xamarin.iOS and Xamarin.Mac SDK 15.10.0.1 (568bdb24e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Screenshots
https://github.com/alececihs/brokenPushModalAsync/blob/master/Screenshots/PushModalAsyncBug.gif
Reproduction Link
https://github.com/alececihs/brokenPushModalAsync
Does this work on Android?
On Android it works. The problem seems to occur on iOS devices only.
any updates
@jfversluis I tested it on maui and I got the same wrong behaviour, https://github.com/alececihs/maui-samples/tree/main/6.0/Navigation/ShellFlyoutSample/ShellFlyoutSample as you can see in the attached video: https://user-images.githubusercontent.com/107032142/188451636-4618a7ec-dc6a-4a5f-83e6-c62a9173a0fc.mp4
Are there any plans to address this or provide a workaround? This is affecting one of our apps on iOS and it only happens when we set IsVisible to false on a FlyoutItem. This bug doesn't manifest itself until after you change the IsiVisible property of any flyitem item from true to false.
Changing IsVisible back from false to true does not remedy the problem. Something "happens" after IsVisible changes once the app is up and running.
I reported the same issue in #15136
Any updates regarding this??
For anyone who is still having trouble with this, I found a potential workaround that might be suitable. Of course, if there is a more practical option, please share.
<Shell.FlyoutContent>
<StackLayout BackgroundColor="White" Spacing="3" Padding="5">
<Button x:Name="selectProject" Text="Select Project" ImageSource="{StaticResource project}" BackgroundColor="Transparent" HorizontalOptions="StartAndExpand"
Command="{Binding FlyoutButtonTappedCommand}" CommandParameter="selectProject" />
<Button x:Name="checklist" Text="Checklist" ImageSource="{StaticResource checklist}" BackgroundColor="Transparent" HorizontalOptions="StartAndExpand"
Command="{Binding FlyoutButtonTappedCommand}" CommandParameter="checklist" />
<Button x:Name="schedule" Text="Schedule" ImageSource="{StaticResource schedule}" BackgroundColor="Transparent" HorizontalOptions="StartAndExpand"
Command="{Binding FlyoutButtonTappedCommand}" CommandParameter="schedule" />
</StackLayout>
</Shell.FlyoutContent>
Each button can easily be hidden and the PushModalAsync works as expected.
The command 'FlyoutButtonTappedCommand' is basically a switch statement that navigates the user to a page that is determined by the CommandParameter. After the switch statement is completed, the flyout is programmatically closed.