Value down, change up
Controlled from JS, always
A Button only emits. A Slider, Switch, or Picker also holds a value β which raises the question every senior gets asked: who owns the state? The answer for a well-behaved native control is the same as for a well-behaved React input: the JS layer owns it. The native view is controlled.
- Value flows down β a
valueprop tells the native control what to display. - Change flows up β an
onValueChangeevent proposes a new value; JS decides whether to accept it and setvalueback down.
In an interview, say: "I build native inputs as controlled components:
valuedown,onValueChangeup, JS owns the source of truth. It keeps the native view stateless and prevents the classic bug where native state and JS state silently diverge."
Red flag: letting the native control hold its own state and only emitting on change (an uncontrolled input). It feels simpler, but the native value and your JS state drift the moment anything else sets the value β and you can't reset or validate from JS. Keep it controlled:
valuedown,onValueChangeup.