Skip to content

How to: handle press/change events

You need to react to a native event (a tap, a value change), and the public shape of that event differs by framework.

<Pressable onPress={() => setCount(count + 1)} />
<Switch value={enabled} onValueChange={setEnabled} />
<TextInput value={name} onValueChange={setName} />

Vue — typed emits, or v-model on controlled components

Section titled “Vue — typed emits, or v-model on controlled components”
<Pressable @press="count++" />
<Switch v-model="enabled" />
<TextInput v-model="name" />
template: `
<Pressable (press)="count = count + 1" />
<Switch [value]="enabled" (valueChange)="setEnabled($event)" />
<TextInput [value]="name" (valueChange)="setName($event)" />
`

TextInput’s React/Vue callback merges what used to be two native callbacks into one onValueChange(text, event) — an EventEmitter can’t carry two values, so Angular keeps (valueChange) text-only and adds a separate (change) output for the raw event.

For the full event-naming table and why a given event became a Vue emit vs stayed a raw passthrough listener, see the Events guide and the Components API.