0.9.1-alpha.45
Alpha@xaui/native@0.9.1-alpha.45
Patch Changes
-
541cbe7: The toast stack collapses, like the reference implementation's.
It was a flex column with a gap: every card fully visible, one under the next, so six toasts took six card heights down the screen. The reference implementation's is a pile — one card in front, the rest scaled down and pushed toward the edge behind it, only their shoulders showing.
Every card is now anchored to the same edge and its depth is entirely in its transform:
translateY: 10toward the edge andscale: 0.97per step, their values, read off theirtoast.animation.ts. A pile of eight costs the height of one. The ladder does not clamp — their interpolation clamps the front side only, so the fourth card is genuinely further back than the third rather than sitting on it and reading as one.limitbecomesmaxVisible, and it no longer discards. A card past it is transparent, keeps its timer and its place, and is promoted into view when the one in front leaves — so a burst of six shows all six instead of losing three. -
7557e46: The front toast can be thrown away with a swipe, like the reference implementation's.
Away from its edge — up on a top stack, down on a bottom one — past 50 points or 500 points a second, their thresholds, either alone being enough. Dragged the wrong way it resists rather than refuses: the whole screen's travel maps onto 40 points. The throw carries on at the speed the finger left it and the record goes a moment later, so a hard flick leaves faster than a soft one.
Only the front card. The ones behind show a seven-point shoulder, which is a target under any reasonable minimum, and dragging the second card out from under the first reads as a glitch rather than as a dismissal.
isSwipeable={false}on the host turns it off.Note that this dismisses one card and the pile empties a swipe at a time — the reference implementation's gesture calls
hide(id), not a clear-all, and their provider has no such thing.The gesture runs on
react-native-gesture-handler, already an optional peer, reached only through@xaui/native/toast. -
f8dfa9d:
Toast— Title · Description · Actions · Close, plusToastHostanduseToastThe card does not know it is in a queue, when it will leave, or what is stacked under it. The host owns all three, and that split is the whole design:
renderreturns anything at all and the queue never looks at it, soToastis the card this library ships rather than the card the host requires.Toast.Closestill knows which toast it belongs to without being told. The host provides the dismiss around each entry and the card folds it into the context its slots read, so a close button two levels down needs nothing passed to it.The variant paints the title, and nothing else. A red card sliding in from the edge of the screen reads as the app breaking; a red line of text reads as the thing you just did failing. The surface stays the theme's floating one whatever happened, which is also what lets two toasts of different kinds stack without the pile looking like a paint chart. It uses the soft foregrounds rather than the full colours, because a toast is read from the corner of the eye and
dangerat full strength is a shout where the soft one is a statement.It slides from the edge it will sit against, where every other overlay here scales in place. A dialog and a popover appear where they are, because they were asked for; a toast arrives, because something happened. Motion across the screen's edge is the difference.
Past
limitthe oldest goes: the newest is the one that just happened, and the reader is looking for it.useToastoutside aToastHostwarns and does nothing rather than throwing. A missing host is a setup mistake in the app shell, and a screen that crashes on its way to reporting that a save succeeded has turned a good outcome into a bad one.It closes P5.18 as well as P5.18b:
SnackbarandToastare the same object under two names, and the reference implementation calls ittoast.