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

Commit 1124b6a

Browse files
committed
Force iOS 13 to use Full Screen for Modal
- Once we are on xCode 11 and can account for swipe dismiss we can make this better
1 parent 4f791d3 commit 1124b6a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using UIKit;
23
using Xamarin.Forms.Internals;
34

@@ -74,6 +75,19 @@ public static void ApplyKeyboard(this IUITextInputTraits textInput, Keyboard key
7475
}
7576
}
7677

78+
internal static UIModalPresentationStyle ToNativeModalPresentationStyle(this PlatformConfiguration.iOSSpecific.UIModalPresentationStyle style)
79+
{
80+
switch (style)
81+
{
82+
case PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FormSheet:
83+
return UIModalPresentationStyle.FormSheet;
84+
case PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FullScreen:
85+
return UIModalPresentationStyle.FullScreen;
86+
default:
87+
throw new ArgumentOutOfRangeException(nameof(style));
88+
}
89+
}
90+
7791
internal static UIReturnKeyType ToUIReturnKeyType(this ReturnType returnType)
7892
{
7993
switch (returnType)

Xamarin.Forms.Platform.iOS/ModalWrapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ internal ModalWrapper(IVisualElementRenderer modal)
1414
_modal = modal;
1515

1616
var elementConfiguration = modal.Element as IElementConfiguration<Page>;
17-
if (elementConfiguration?.On<PlatformConfiguration.iOS>().ModalPresentationStyle() == PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FormSheet)
18-
ModalPresentationStyle = UIKit.UIModalPresentationStyle.FormSheet;
17+
var modalPresentationStyle = elementConfiguration?.On<PlatformConfiguration.iOS>()?.ModalPresentationStyle() ?? PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.FullScreen;
18+
ModalPresentationStyle = modalPresentationStyle.ToNativeModalPresentationStyle();
1919

2020
View.BackgroundColor = UIColor.White;
2121
View.AddSubview(modal.ViewController.View);

0 commit comments

Comments
 (0)