Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 1 addition & 19 deletions src/Core/src/Handlers/Editor/EditorHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,10 @@ public partial class EditorHandler : ViewHandler<IEditor, MauiTextView>
protected override MauiTextView CreatePlatformView()
{
var platformEditor = new MauiTextView();

#if !MACCATALYST
var accessoryView = new MauiDoneAccessoryView();
accessoryView.SetDataContext(this);
accessoryView.SetDoneClicked(OnDoneClicked);
platformEditor.InputAccessoryView = accessoryView;
#endif

platformEditor.AddMauiDoneAccessoryView(this);
return platformEditor;
}

#if !MACCATALYST
static void OnDoneClicked(object sender)
{
if (sender is IEditorHandler handler)
{
handler.PlatformView.ResignFirstResponder();
handler.VirtualView.Completed();
}
}
#endif

public override void SetVirtualView(IView view)
{
base.SetVirtualView(view);
Expand Down
9 changes: 7 additions & 2 deletions src/Core/src/Handlers/Entry/EntryHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ public partial class EntryHandler : ViewHandler<IEntry, MauiTextField>
{
readonly MauiTextFieldProxy _proxy = new();

protected override MauiTextField CreatePlatformView() =>
new MauiTextField
protected override MauiTextField CreatePlatformView()
{
var platformEntry = new MauiTextField
{
BorderStyle = UITextBorderStyle.RoundedRect,
ClipsToBounds = true
};

platformEntry.AddMauiDoneAccessoryView(this);
return platformEntry;
}

public override void SetVirtualView(IView view)
{
base.SetVirtualView(view);
Expand Down
19 changes: 19 additions & 0 deletions src/Core/src/Platform/iOS/TextFieldExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,24 @@ internal static void UpdateClearButtonColor(this UITextField textField, IEntry e
context?.FillRect(rect, CGBlendMode.SourceIn);
});
}

internal static void AddMauiDoneAccessoryView(this UITextField textField, IViewHandler handler)
{
#if !MACCATALYST
var accessoryView = new MauiDoneAccessoryView();
accessoryView.SetDataContext(handler);
accessoryView.SetDoneClicked(OnDoneClicked);
textField.InputAccessoryView = accessoryView;
#endif
}

static void OnDoneClicked(object sender)
{
if (sender is IEntryHandler entryHandler)
{
entryHandler.PlatformView.ResignFirstResponder();
entryHandler.VirtualView.Completed();
}
}
}
}
19 changes: 19 additions & 0 deletions src/Core/src/Platform/iOS/TextViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,24 @@ static UITextPosition GetSelectionEnd(UITextView textView, IEditor editor, UITex

return end;
}

internal static void AddMauiDoneAccessoryView(this UITextView textView, IViewHandler handler)
{
#if !MACCATALYST
var accessoryView = new MauiDoneAccessoryView();
accessoryView.SetDataContext(handler);
accessoryView.SetDoneClicked(OnDoneClicked);
textView.InputAccessoryView = accessoryView;
#endif
}

static void OnDoneClicked(object sender)
{
if (sender is IEditorHandler entryHandler)
{
entryHandler.PlatformView.ResignFirstResponder();
entryHandler.VirtualView.Completed();
}
}
}
}
Loading