Render Slider and TextField#14
Merged
Merged
Conversation
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.
Re-lands the commits from #13, which never reached
master— the same way #10 didn't.#13 was based on
feature/form-controlsand 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/Androidmaster (now containing #45 and #47).Original description follows.
Slider
Rendered as a
SeekBar, bound to itsDoublewithin its range.SeekBarreports whole numbers whileSliderworks 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 itsString, 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,
SeekBarOnSeekBarChangeListenerandEditTextTextWatcher.Both differ from
ViewOnClickListenerin one respect worth noting: the Kotlin side collapses the interface's callbacks into a singleexternalmethod and drops the view argument, rather than declaring the interface methods themselvesexternal. 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 theSeekBarpointer as the progress value and reported-8652525%. Forwarding only what Swift declares keeps the signatures aligned.TextWatcheralso has no Swift binding at all, soEditTextTextWatcherregisters itself on the field from Kotlin.SeekBarOnSeekBarChangeListenerdoes 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
StepperandPicker.Stepperhas no definition in the vendored SwiftUI layer at all, so it needs new API surface rather than just a renderer.Pickerrenders 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:
@State(50% → 76%), with the label tracking it.