iOS: opt-in iosReturnExitsEditing for multi-line TextArea (#4854)#4859
Merged
shai-almog merged 1 commit intomasterfrom May 3, 2026
Merged
iOS: opt-in iosReturnExitsEditing for multi-line TextArea (#4854)#4859shai-almog merged 1 commit intomasterfrom
shai-almog merged 1 commit intomasterfrom
Conversation
…Area (#4854) Adds a guarded client property `iosReturnExitsEditing` that, when set on a multi-line TextArea, makes the iOS keyboard's Return key act as Done -- it exits editing (firing the Done listener) instead of inserting a newline. This mirrors the iOS Reminders task-title field. The Return key is relabeled to "Done" via UIReturnKeyDone while the flag is set. The flag is wired through the existing editStringAt native call (mirroring the blockCopyPaste/showToolbar pattern), gated to multi-line TextAreas only, and defaults to off so existing behavior is unchanged. The interception lives in textView:shouldChangeTextInRange:replacementText: in both EAGLView and METALView and only fires for an exact "\n" replacement, leaving pasted multi-line text untouched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 86 screenshots: 86 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iosReturnExitsEditingthat makes the iOS keyboard's Return key act as Done on a multi-lineTextArea-- exits editing (firing the Done listener) instead of inserting a newline. Mirrors the iOS Reminders task-title field.UIReturnKeyDone).TextAreas, and only intercepts an exact"\n"replacement so pasted multi-line text is unaffected.Closes #4854.
Why this shape
The reporter wants the Reminders-style growing text field where Return finishes editing rather than inserting a newline. Native iOS doesn't expose this as a built-in primitive -- Reminders implements it on a
UITextViewwhose delegate intercepts\ninshouldChangeTextInRange:. We replicate that exactly, gated behind an opt-in client property so no existing layout changes behavior.Touchpoints
IOSNative.java/IOSImplementation.java-- addboolean returnExitsEditingtoeditStringAt, populated fromcmp.getClientProperty(\"iosReturnExitsEditing\")and forced false on single-line text fields.IOSNative.m-- bridge function gets the newJAVA_BOOLEANparameter; mangled name updated.CodenameOne_GLViewController.m-- new globalBOOL currentlyReturnExitsEditing(mirrors the existingcurrentlyEditingMaxLengthpattern); set ineditStringAtImpl; in theUITextViewbranch, forcesreturnKeyType = UIReturnKeyDonewhen the flag is set.EAGLView.m/METALView.m--textView:shouldChangeTextInRange:replacementText:intercepts a single\nreplacement when the flag is set, calls existingkeyboardDoneClicked(which firesstringEdit(YES, ...)-> JavafireDoneEvent), and returns NO to suppress the newline insertion.Usage
Test plan
./scripts/build-ios-port.sh -DskipTestsTextAreawithiosReturnExitsEditing=true-- pressing Return ends editing and the Done listener fires; long input wraps to multiple visible rows.TextAreawithout the property -- Return still inserts\n(unchanged).TextFieldregardless of property -- Return still resigns first responder (unchanged).TextAreawith the property set -- newlines are preserved (interception is single-\n-only).iosHideToolbarnot set) still work as before.🤖 Generated with Claude Code