Oh this worked
using UIKit;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Platform;
namespace App.Platforms.IOS.EntryDone
{
public class EntryDoneHandler : EntryHandler
{
protected override void ConnectHandler(MauiTextField textField)
{
base.ConnectHandler(textField);
if (VirtualView is Entry entry &&
(entry.Keyboard == Keyboard.Numeric))
{
AttachDoneToolbar(textField);
}
}
private void AttachDoneToolbar(MauiTextField textField)
{
// 1. Specify a frame. iOS needs a defined height to properly
// render the toolbar ABOVE the keypad rather than replacing it.
var toolbar = new UIToolbar(new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 44))
{
BarStyle = UIBarStyle.Default,
Translucent = true
};
var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) =>
{
textField.ResignFirstResponder();
// Optional: manually fire the Completed event
VirtualView?.Completed();
});
var flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
toolbar.SetItems(new[] { flexSpace, doneButton }, animated: false);
// 2. Assign to InputAccessoryView (NOT InputView)
textField.InputAccessoryView = toolbar;
// 3. Ensure the keypad type is correct
// If this is set to UIKeyboardType.Default, it might hide the numpad.
if (textField.KeyboardType == UIKeyboardType.Default)
{
textField.KeyboardType = UIKeyboardType.NumberPad;
}
}
}
}