Skip to content

Commit d990f18

Browse files
Workaround receiving events with Shell on iPhone
Fixes: #3
1 parent 7e86d93 commit d990f18

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Plugin.Maui.KeyListener/KeyboardPageViewController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ public class KeyboardPageViewController : PageViewController
1313
internal KeyboardPageViewController(IView page, IMauiContext mauiContext)
1414
: base(page, mauiContext) { }
1515

16+
#if IOS // Workaround to allow receiving keys when the root page is a Shell
17+
public override bool CanBecomeFirstResponder => true;
18+
19+
public override void ViewIsAppearing(bool animated)
20+
{
21+
base.ViewIsAppearing(animated);
22+
23+
BecomeFirstResponder();
24+
}
25+
#endif
26+
1627
public override void PressesBegan(NSSet<UIPress> presses, UIPressesEvent evt)
1728
{
1829
if (ProcessPresses(presses, evt, false))

0 commit comments

Comments
 (0)