Skip to content

Render Slider and TextField#14

Merged
colemancda merged 8 commits into
masterfrom
feature/slider-textfield-reland
Jul 22, 2026
Merged

Render Slider and TextField#14
colemancda merged 8 commits into
masterfrom
feature/slider-textfield-reland

Conversation

@colemancda

Copy link
Copy Markdown
Member

Re-lands the commits from #13, which never reached master — the same way #10 didn't.

#13 was based on feature/form-controls and merged ten minutes after that branch had already gone to master via #12, so its commits landed on a branch that was no longer going anywhere. These are the same eight commits, cherry-picked onto master cleanly with no conflicts.

Verified fresh: the local dependency mirror used to develop against the then-unmerged bindings has been removed, and this builds and runs against real upstream PureSwift/Android master (now containing #45 and #47).

Original description follows.

Slider

Rendered as a SeekBar, bound to its Double within its range.

SeekBar reports whole numbers while Slider works in a floating point range, so the bar is divided into steps — matching the slider's own step when it has one, so the thumb lands exactly on each value, and a fixed fine-grained scale when continuous.

TextField

Rendered as an EditText, bound to its String, with the label as the hint.

The update path only writes back when the text actually differs. Writing unconditionally would reset the cursor to the start on every keystroke, since the watcher has already applied the user's edit by the time the reconciler runs.

JNI bridges

Two new bridges, SeekBarOnSeekBarChangeListener and EditTextTextWatcher.

Both differ from ViewOnClickListener in one respect worth noting: the Kotlin side collapses the interface's callbacks into a single external method and drops the view argument, rather than declaring the interface methods themselves external. The native symbol is derived from the Swift signature, so a Kotlin method that passes extra leading arguments shifts everything — the first version of the slider read the SeekBar pointer as the progress value and reported -8652525%. Forwarding only what Swift declares keeps the signatures aligned.

TextWatcher also has no Swift binding at all, so EditTextTextWatcher registers itself on the field from Kotlin. SeekBarOnSeekBarChangeListener does the same for symmetry.

Layout

The determinate progress track and the seek bar both span the stack rather than hugging their content. A seek bar at its intrinsic width collapses to just the thumb and cannot be dragged at all; the horizontal progress track is similarly meaningless. The indeterminate spinner keeps its natural size.

Not included

Stepper and Picker. Stepper has no definition in the vendored SwiftUI layer at all, so it needs new API surface rather than just a renderer. Picker renders through _PickerContainer, whose generic selection value needs mapping to and from adapter indices — enough work to be worth its own change.

Verification

On the emulator, against upstream bindings:

  • The slider drags and drives its bound @State (50% → 76%), with the label tracking it.
  • Typing into the text field updates its binding per keystroke, with the cursor staying put ("Verified" → "Hello, Verified").
  • Toggle and both progress views still behave as before.

@colemancda
colemancda merged commit b29533f into master Jul 22, 2026
6 checks passed
@colemancda
colemancda deleted the feature/slider-textfield-reland branch July 22, 2026 16:27
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