Skip to content

feature: submit-label prop for the return key / IME action - #69

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/text-input-submit-label
Open

feature: submit-label prop for the return key / IME action#69
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/text-input-submit-label

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Aug 24, 2026

Copy link
Copy Markdown
Member

What's wrong

  1. The keyboard's submit key can't be configured. On iOS the label is hardcoded — Done when @submit is wired, Return otherwise (NativeUITextInputCore.swift); on Android keyboardOptionsFor never sets an IME action. So a multi-field form can't show the platform Next/Go/Search/Send affordance.

What this does

  • Adds an opt-in submit-label prop (next | done | go | search | send | return) to the three text inputs, mapping to SwiftUI SubmitLabel on iOS and Compose ImeAction on Android. Blade takes submit-label or submitLabel; the fluent ->submitLabel() validates and throws on unknown values.
  • Moves the filled/outlined Android renderers from KeyboardActions(onDone) to onAny (the bare renderer's existing shape) — with a non-Done IME action, an onDone-only handler would silently drop the @submit dispatch. For the default action the two are equivalent.
  • Multiline fields ignore the prop on both platforms: their return key must keep inserting newlines (.submitLabel on a vertical-axis TextField would replace that — same territory as fix(ios): multiline inputs must insert a newline on every keyboard #42).
  • Tests: serialization on every variant, all values, both attribute spellings, normalization, unset-not-serialized, invalid throws.

Unset keeps each platform's behaviour byte-for-byte. return is iOS vocabulary (a plain Return key); Android renders its IME default for it. The bare input picks the label up through the shared keyboardOptionsFor as soon as #51 lands (bare doesn't apply keyboard options today).

Before / after (same Blade)

Android emulator, API 36 — the action key goes from the generic checkmark to Next; the numeric field (keyboard="number" submit-label="done") shows the number pad with a Done key:

iOS simulator, iPhone 17 (26.5) — the return key goes from return to next (iOS 26 renders the labels as glyphs):

The "after" builds also carry the follow-up focus-chaining branch; the key face goes through the same resolveImeAction/resolveSubmitLabel path either way.

Happy to PR the matching lines to the text-input docs page once the API is agreed.

Forms with several fields need the platform Next/Go/Search/Send key,
but the submit key face was out of reach: hardcoded on iOS
(.done when @submit is wired, .return otherwise) and never set on
Android (keyboardOptionsFor omitted imeAction entirely).

Adds an opt-in submit-label prop (next|done|go|search|send|return) to
the three text inputs, mapping to SwiftUI SubmitLabel and Compose
ImeAction. Unset keeps each platform's behaviour byte-for-byte.
Multiline fields ignore the prop on both platforms — their return key
must keep inserting newlines.

The filled/outlined Android renderers move from KeyboardActions(onDone)
to onAny (the bare renderer's existing shape): with a non-Done IME
action an onDone-only handler would silently drop the @submit dispatch.
For the default action the two are equivalent.

The fluent submitLabel() validates and throws on unknown values;
Blade accepts submit-label and submitLabel.
@SRWieZ SRWieZ changed the title Add a submit-label prop for the return key / IME action feature: submit-label prop for the return key / IME action Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant