@animatereactnative/stagger

中文文档
0.3.0发布于 2024/02/12MITTypeScriptESM + CJS零依赖近 30 天下载 1.1万

A React Native stagger component

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Props
  4. Contributing
  5. License

React Native Stagger

AnimateReactNative.com - Premium and Custom React Native animations.

NPM Version runs with expo npm npm Follow Miron Catalin

React Native Stagger component, a cross-platform stagger orchestrator component, powered by Reanimated:

  • 🔋 Powered by Reanimated 3 Layout Animations
  • 📱 Works with Expo
  • ✅ Cross-platform (iOS, Android, Web - requires reanimated@>=3.4.0)
  • ⚡️ 60-120fps
  • 🪝 Works with any React Native element/component
  • ⌨️ Written in TypeScript

Installation

npm install @animatereactnative/stagger

Also, you need to install react-native-reanimated, and follow their installation instructions.

Usage

import { Stagger } from '@animatereactnative/stagger';

// ...

export function Example() {
  return (
    <Stagger
      stagger={50}
      duration={300}
      exitDirection={-1}
      entering={() => ZoomInEasyDown.springify()}
      exiting={() => FadeOutDown.springify()}
      style={{
        flexDirection: 'row',
        flexWrap: 'wrap',
        justifyContent: 'center',
        gap: 12,
      }}
    >
      <Paragraph>1. Custom duration</Paragraph>
      <Paragraph>2. Custom stagger</Paragraph>
      <Paragraph>3. Custom animation</Paragraph>
      <Paragraph>4. Custom enter/exit direction</Paragraph>
      <Heading>AnimateReactNative.com</Heading>
      <Heading>Powered by Reanimated 3</Heading>
      <Heading>Works with Expo ❤️</Heading>
    </Stagger>
  );
}

Props

namedescriptionrequiredtypedefault
childrenAny component that you'd like to apply infinite scrolling / marquee effectYESReact.ReactNode1
enabledEnable stagger animationNObooleantrue
staggerStagger duration between elementsNOnumber50
durationEnter/Exit animation durationNOnumber400
enterDirectionThe direction of the animation. 1 -> top to bottom, -1 -> bottom to topNOnumber0
exitDirectionThe direction of the animation. 1 -> top to bottom, -1 -> bottom to topNOnumber0
initialEnteringDelayInitial enter animation delayNOnumber1
initialExistingDelayInitial exit animation delayNOnumber-1
onEnterFinishedcallback to announce when the last item animation has finished (direction dependent)NO() => voidundefined
onExitFinishedcallback to announce when the last item animation has finished (direction dependent)NO() => voidundefined
enterReanimated Enter animationNO() => ComplexAnimationBuilderFadeInDown
exitingReanimated Exit animationNO() => ComplexAnimationBuilderFadeOutDown
styleView style to be applied to Marquee container.NOStyleProp<ViewStyle>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


AnimateReactNative.com - Premium and Custom React Native animations.

版本与发布记录

@animatereactnative/stagger 共发布 4 个版本,首次发布于 2023/08/31;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.3.0latest2024/02/122 年前
0.2.02023/11/152 年前
0.1.22023/11/142 年前
0.1.12023/08/313 年前

关于 @animatereactnative/stagger 的常见问题

@animatereactnative/stagger 是什么?

A React Native stagger component

如何安装 @animatereactnative/stagger?

在项目目录运行 npm install @animatereactnative/stagger,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)、react-native-reanimated(>=2.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@animatereactnative/stagger 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@animatereactnative/stagger 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@animatereactnative/stagger 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 16.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@animatereactnative/stagger 可以商用吗?

@animatereactnative/stagger 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@animatereactnative/stagger 的下载量有多少?

根据 npm 官方下载统计,@animatereactnative/stagger 在 2026/10/06 – 2026/11/04 这 30 天内被下载 11,168 次,日均约 372 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@animatereactnative/stagger 还在维护吗?

最新版本 0.3.0 发布于 2024/02/12(2 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/08/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。