React Native tier

Stagger

Children that arrive one after another.

iOSReact Native ViewAndroidReact Native ViewReact Native tier: renders anywhere
iOSReact Native View
AndroidReact Native View

Import

ts
import {Stagger} from '@hzblj/kara-ui'

Examples

Your own timing

tsx
<Stagger entering="scale" from="end" interval="micro">{sizes}</Stagger>

Making room when one leaves

tsx
<Stagger exiting="fade" layout>{cartItems}</Stagger>

Props

A Box whose children arrive one after another: each takes entering a step later than the one before. Children that arrive together are staggered among themselves, the first ones as much as a later batch (the next page of a list), while a single child added later arrives at once. A Box, RnText or Pressable child takes the motion itself; any other child is wrapped in a Box that does. With motion reduced every child fades, still one after another. The React Native tier: it needs no host.

Also takes the React Native `sx` props.

PropTypeDefaultDescription
childrenReactNode

What arrives. A child with an entering preset of its own keeps it and only takes the delay.

enteringStaggerMotion'fadeUp'

How each child arrives. fadeUp by default.

exitingStaggerMotion

How a child leaves when it is removed. They leave together, not one after another; none by default.

from'end' | 'start''start'

Which end arrives first. start by default.

intervalDurationSize'stagger'

The step between one child and the next, a duration token. stagger (40 ms) by default, micro for a slower one.

layoutboolean | SpringName

Moves the other children into place when one arrives or leaves, and the stagger itself to its new size: true on the smooth spring, or a spring token. Off by default. Give what sits after it layout too, so it follows.

testIDstring

Test identifier, forwarded to the view.

children
ReactNode

What arrives. A child with an entering preset of its own keeps it and only takes the delay.

entering'fadeUp'
StaggerMotion

How each child arrives. fadeUp by default.

exiting
StaggerMotion

How a child leaves when it is removed. They leave together, not one after another; none by default.

from'start'
'end' | 'start'

Which end arrives first. start by default.

interval'stagger'
DurationSize

The step between one child and the next, a duration token. stagger (40 ms) by default, micro for a slower one.

layout
boolean | SpringName

Moves the other children into place when one arrives or leaves, and the stagger itself to its new size: true on the smooth spring, or a spring token. Off by default. Give what sits after it layout too, so it follows.

testID
string

Test identifier, forwarded to the view.

Platform notes

  • Each child takes entering a step (interval, 40 ms by default) after the one before it.
  • Only the children that arrive together take turns: the first ones, or the next page of a list. A single item added later arrives at once instead of after everything above it.
  • A Box, RnText or Pressable child takes the motion itself, so no view is added around it; any other child is wrapped in a Box.
  • With Reduce Motion on, every child fades, still one after another.