Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Fix pushing same page as a modal on iOS13 in split mode #12871

Merged
merged 9 commits into from
Nov 24, 2020
Merged

Conversation

rmarinho
Copy link
Member

@rmarinho rmarinho commented Nov 16, 2020

Description of Change

There's a issue on iOS13 that pushing a modal using your app in split mode, (side by side with other app), it causes issues rendering the second time.
The particular issue is also related with retaining the pushed page , it keeps it's bounds, and we need to force the layout.
Workaround could be to just reset is bounds when is popped.

Issues Resolved

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

None

Before/After Screenshots

Testing Procedure

Go to Issue8988 , click Next, check the page loaded, click Go Back, then click again Next and make sure the page loads fine.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@rmarinho rmarinho added a/modal p/iOS 🍎 blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. labels Nov 16, 2020
@rmarinho rmarinho changed the title [iOS] Fix pushing same page as a modal on iOS13 [iOS] Fix pushing same page as a modal on iOS13 in split mode Nov 16, 2020
@@ -49,9 +49,6 @@ internal ModalWrapper(IVisualElementRenderer modal)
PresentationController.Delegate = this;

((Page)modal.Element).PropertyChanged += OnModalPagePropertyChanged;

if (Forms.IsiOS13OrNewer)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was duplicated

modalWrapper.Dispose();
}
#endif
renderer.NativeView.RemoveFromSuperview();
renderer.Dispose();
//reset layout size so we can re-layout the layer if we are reusing the same page.
//fixes a issue on split apps on iPad and iOS13
visualElement.Layout(new Rectangle(0, 0, -1, -1));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is here.

Copy link
Contributor

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmarinho curious your thoughts on this approach.

https://github.com/xamarin/Xamarin.Forms/compare/fix-8988-shane

There might be a better fix is inside VisualElementPackager

Setting the layout bounds to -1 was causing some extra code in VEP to run that basically would set the frame back to the Element bounds. The other curiosity here is why iOS keeps wanting to set the PageContainer.Frame to 526 unprompted :-/ Finding and fixing that might also be a preferred approach though that might just be the SplitView being quirky

@rmarinho
Copy link
Member Author

@PureWeen just tested, and yeah looks a better fix

@rmarinho rmarinho merged commit 1e11ae8 into 5.0.0 Nov 24, 2020
@rmarinho rmarinho deleted the fix-8988 branch November 24, 2020 17:17
@samhouts samhouts added this to the 5.0.0 milestone Dec 8, 2020
@samhouts samhouts added i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often iOS 13 t/bug 🐛 labels Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/modal blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often iOS 13 p/iOS 🍎 t/bug 🐛
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] App freezes on iPadOS 13.3 when in split view mode (multi-tasking) and change between pages
4 participants