-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] After PopModalAsync will not call OnAppearing (iOS) #13258
Comments
Hi, @oleksandrtretiak - thanks for submitting this issue! I tried reproducing what you described, but unfortunately wasn't able to. I see the calls to OnAppearing made on both the first page and modal page when running on 5.0pre6. Would you mind sharing your project / a sample project or modifying this sample project to reproduce the behavior you're experiencing? Thanks :) |
Hi, @rachelkang ! Sorry that I gave you not enough details. The problem with BackgroundColor of NavigationPage; Or download the updated project. |
Came to report the same issue, did not realise the issue is setting BackgroundColor. I'll go try fix that as a workaround for me. As for this issue, I was able to replicate the issue by changing the Push_Modal method from the original sample to look like so
Main difference from @oleksandrtretiak comment above is that you don't need to use NavigationPage in the PushModal. I have updated the sample with a few changes.
EDIT 1: Looking into the XF source code ViewDidAppear, ViewWillAppear, ViewDidDisappear in Xamarin.Forms.Platform.iOS.NavigationRenderer do not get called if we called PushModal with new page with the BackgroundColor property set. I have made a repo issue in the XF control gallery on my own fork here. EDIT 2: |
This is an issue for us too. |
I tested what @PaulMercer-SDS mentioned 5.0.0.1558-pre3 works I had a real quick browse of pre4 and what had changed and nothing stood out immediately. |
I ran into the same issue after going from forms 4.5 to latest 5.0.0.1931 On iOS the OnAppearing does not fire. On Android it still does. In my case this breaks the App quite a bit. |
Any workaround, or a time frame for a fix for this issue? I've upgraded from XF 4.8 to 5.0.0.2012, and per this issue description, the OnAppearing event no longer fires after PopModalAsync on the iOS version of my app. Android works as expected. |
I reran tests to see what needs to be done to ship my app, and will need to roll back to release 4.8.0.1821. Tests done: |
@DawidBester , a workaround for now is if you don't set the BackgroundColor of the new page issue won't occur. I went and swapped all references of BackgroundColor on my content pages with Background and I feel yuck for doing so. But at least my app works as expected now 🤷♂️ |
@beeradmoore thanks! I've tested and changing BackgroundColor to Background on the ContentPage works using 5.0.0.2012. Now to go through the app and change all references. Definitely not ideal, but better than downgrading to 4.8.0.1821. |
Hello there, |
@Henryegal I changed BackgroundColor to Background as I still needed to set a background color for the page, and this was the only change I made. I did not test just removing BackgroundColor and then not setting a Background for the page. |
@DawidBester Thanks for the info! I did change BackgroundColor="LightBlue" Very painful! |
I removed the BackgroundColor assignment completely from the modal page's ContentPage xaml, so there was no assigned BackgroundColor at the page level. Then down inside the xaml page Content's first visual element that would show a background color (ListView) I added the same BackgroundColor assignment, and that worked for me as my workaround - to keep the background color and get around this strange unfortunate bug. (Xamarin.Forms 5.0.0.2012) Thanks to everyone who left comments above - it has saved my day today. |
I had the same issue when pushing a modal from a contentpage then closing it would not call the OnAppearing method, but I was able to use the workaround that was mentioned here of using Background instead of BackgroundColor for the modal page. Thank you guys for the workaround!!! |
We were having the same issue where, on iOS, popping a modal page did not call OnAppearing() on the page that is now visible. Android worked fine. Rather than change from BackgroundColor to Background, instead we push the modal page wrapped in a navigation page, and have added the following attribute on our modal page: That seems to solve the problem, and doesn't require using the Background workaround, and the appaerance of the page seems consistent with what we had before. |
Hi there,
Great thanks for the info. I will look into this. I had to rework this and not use OnAppearing as I was rushed to get it in the store.
Thanks!
Henry Egal
Software Developer
Horizon Information Systems, Inc.
435 Napoleon St. Johnstown, PA 15901<https://www.bing.com/maps?q=Horizon+Information+Systems&FORM=HDRSC4> | • (814) 535-7810
***@***.***D73490.809C9780]<https://www.horizon-is.com/>
[Text Description automatically generated]<https://compliancy-group.com/>
From: hydnar ***@***.***>
Sent: Sunday, April 18, 2021 8:18 PM
To: xamarin/Xamarin.Forms ***@***.***>
Cc: Henry Egal ***@***.***>; Mention ***@***.***>
Subject: Re: [xamarin/Xamarin.Forms] [Bug] After PopModalAsync will not call OnAppearing (iOS) (#13258)
We were having the same issue where, on iOS, popping a modal page did not call OnAppearing() on the page that is now visible. Android worked fine.
We're setting the BackgroundColor on the modal page to white.
We were not wrapping the modal page with a navigation page.
Rather than change from BackgroundColor to Background, instead we push the modal page wrapped in a navigation page, and have added the following attribute on our modal page:
NavigationPage.HasNavigationBar="false"
That seems to solve the problem, and doesn't require using the Background workaround, and the appaerance of the page seems consistent with what we had before.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#13258 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOT6W5IKSTFZSPTA2MICY7LTJNZD3ANCNFSM4VPKVB6Q>.
|
Having the same problem here since we started 'themeing' our XF app. On iOS we don't see the underlying form's OnAppearing firing again when a modal dialog is popped. If we prevent the app from changing the BackgroundColor property again, it all works as it's supposed to. |
I have the same problem, do you have a solution time? |
We are facing the same issue. I've updatet Xamarin.Forms to the newest version 5.0.0.2125, unfortunatly it is still there. |
Did you plan to release a fix soon ? |
I tried the differents workarounds mentioned (BackgroudColor and wrapped NavigationPage) but none of them worked. |
We are facing the same issue. What is the current status of this? |
At this moment, we are using a workaround with page Disappearing.
This works fine for now, but is there by chance any proper fix in Xamarin.Forms that OnAppearing is triggered the right way? |
we're having this problem in an app today, on one particular page I have found a workaround by overriding ModalPopped in the calling page, and then after checking if the device is iOS, I then do some of the functionality that should be done in the Appearing method. |
+1 with this issue. I will try the workarounds proposed here. |
On the bright side, I re-implemented my broken project from above in MAUI and the issue is fixed over there. |
Hello?! Two years later this still dosnt work? @xamarin-release-manager |
Description
Steps to Reproduce
Expected Behavior
Page1 Call OnAppearing
Actual Behavior
Nothing
Basic Information
Environment
Screenshots
Reproduction Link
Workaround
The text was updated successfully, but these errors were encountered: