0.9.1-alpha.50
Alpha@xaui/native@0.9.1-alpha.50
Patch Changes
-
8b2c0e5: feat(radio):
Radio.Group— the set an option belongs toRadioshipped without one, which meant the one thing a radio is for — exclusive selection — was the caller'suseStateand theirmap. This is the context it was written to read, not a second radio.It is
Radio.Group, not aRadioGroupimport. The set publishes the values an option already reads and nothing else; a second module to make three radios exclusive would be a seam with nothing behind it.RadioGroupis exported as an alias for a call site that reads better naming it.Membership is a
value, not a nesting. The group holds the chosen one, each option compares the one it stands for, and nothing walks the children — so an option inside aCard, aList.Itemor aFragmentis in the set exactly as much as a direct child is. That is also what keeps a standalone radio over its ownisSelectedworking unchanged inside a group: an option with novalueis not in the set at all.variant,size,radiusandcolorare handed down as defaults, and an option that names its own wins — a set is usually uniform, and the row that differs is a design rather than a mistake.isDisabledandisInvalidare the two that do not work that way: a disabled set has no enabled option in it, and a set that is wrong is wrong on every row.The group lays its options out, which is R4 and the reason it has a recipe at all — the gap follows
size, andorientation="horizontal"wraps rather than overflowing off a narrow screen. It paints nothing, because an option resolves its own colours and a group that painted would be painting over the row that disagreed with it.isSelectedstill outranks the set, so one option in a group can be driven by something the group knows nothing about, and both callbacks fire on a press: the option'sonSelectedChangeand the set'sonValueChange. Pressing the chosen option fires neither — a press selects and never clears, one level up from where theRadioalready said so.useRadioGroup()is exported (R10) for an option of your own that is in the set without being aRadio.accessibilityRole="radiogroup"moves onto the group, where the wrapper in the old three-line recipe used to carry it.