id gives a component a stable identity for diffing, animation, and scroll position tracking. tag associates a component with a selection value inside controls like Picker.
onAppear and onDisappear run a callback when the component is inserted into or removed from the view tree — use them to load data, start and stop timers, or trigger animations.
id
Sets a stable identity for diffing and animations.A unique identifier for this component. Used by the framework for diffing, animations, and scroll position tracking.
id value tells the framework this is a new component, triggering removal of the old one and insertion of the new one (including any transition animations).
.id() together with .scrollPosition() to track or scroll to specific children.
tag
Sets a tag value for identifying a component in selection contexts.The tag value used to identify this component. Typically a string or number. Must match the type of the Picker’s selection value.
.tag() that corresponds to the selection value.
.tag() value must match the type used in the Picker’s value and setValue props. Tags are primarily used with Picker components to associate each option with a selection value.
onAppear
Runs an action when the component first appears on screen.A callback that runs when the component appears on screen for the first time.
onDisappear
Runs an action when the component is removed from the screen.A callback that runs when the component is removed from the view tree.
See also
- onChange — runs an action when a value changes
- Picker — selection control that uses
tagvalues - scrollPosition — track or scroll to children identified by
id - transition — animate insertion and removal triggered by identity changes