| Builder | What you supply | What comes back |
h.stack, h.row | Child views with .children(...) | No event |
h.label | value (text) | No event |
h.button | title; optional focus and keyboard shortcut | press |
h.checkbox | title and checked; optional focus and keyboard shortcut | change with a boolean |
h.slider | Numeric value; optional accessibilityLabel and focus | change with a number |
change and read checked from the model on the next render. The model can reject the change; the control should then show the old value. Text fields with controlled selection and IME composition are not built-ins in this release. See the counter for a working checkbox, slider and keyboard shortcut together.step. TypeScript gives the native view a name and a small JSON contract: a selected number goes in; a chosen number comes out.123const PresetPicker = defineNativeView<{ selected: number }, { step: number }>("PresetPicker") // Inside the component's view: PresetPicker({ selected: model.step }, event => Message.Choose(event))
NativeViewRegistration. Decode the props, bind a SwiftUI Picker to props.selected, and call emit(PresetEvent(step: newValue)) when the user chooses a segment. Pass that registration in EffectSwiftUISurface(script:registrations:). There’s no second stored step value in Swift. See the complete Swift registration.
bun run demo:presets. Select 5, press the count button, then hide and show the picker. The count advances by five, and the selection survives because it belongs to the model.defineNativeContainer in the pocket component with NativeViewRegistration(name:container:) in the app. Render the provided child views rather than creating another set of task rows in Swift.