@animatereactnative/accordion

中文文档
0.1.5发布于 2025/01/23MITTypeScriptESM + CJS零依赖近 30 天下载 1850

由能渲染和动画内容具有动态高度的React Introduct Entroduct动画所提供动力.

中文使用文档
文档目录5 节
  1. 安装
  2. 使用量
  3. 道具
  4. 捐款
  5. 许可证

反应原生Andion元件,是跨平面手风琴元件,由再动能提供动力,能够显示动态高能内容并激活可折叠和可扩展状态之间的布局变化/过渡.

如果您打算将这个组件与其他组件(作为兄弟姐妹)一起使用,建议使用 Accordion.Sibling 并用它包住兄弟们。 这是因为暴露 Sibling 组件也会使用布局动画,所以不会出现布局变化或突然移动,保持一切平稳.

  • 由重力驱动
  • 与博览会合作
  • • 跨平台(iOS、Android、Web-wip)
  • 60-120小时
  • QQ 具有任何反应原生元素/组件的工作
  • * 组成准备就绪
  • QQ 在类型脚本中写入

安装

npm install @animatereactnative/accordion

还有,你需要安装 反应-原生再激活,并遵循其安装指令.

使用量

import { Accordion } from '@animatereactnative/accordion';

// ...

export function Example() {
  return (
    <Accordion.Accordion>
      <Accordion.Header>
        <Text>AnimateReactNative.com</Text>
        <Accordion.HeaderIcon>
          <ChevronUp />
        </Accordion.HeaderIcon>
      </Accordion.Header>

      <Accordion.Collapsed>
        <Text>Visible !expanded</Text>
      </Accordion.Collapsed>
      <Accordion.Always>
        <Text>Always visible</Text>
      </Accordion.Always>

      <Accordion.Expanded>
        <Text>Expanded content</Text>
        {loading && <ActivityIndicator />}
        {data & <MyList data={data} />}
      </Accordion.Expanded>
    </Accordion.Accordion>
  );
}

道具

Accordion = {
  /**
   * The main component that will handle the state of the accordion.
   *
   * @param isOpen boolean
   * @param onChange (value: boolean) => void
   */
  Accordion
  /**
   * The header of the accordion.
   */
  Header,
  /**
   * The component that will wrap any children and it will apply a rotation to it.
   *
   * @param children
   * @param rotation clockwise | counter-clockwise
   */
  HeaderIcon
  /**
   * This is the content that will be displayed when the accordion is open
   */
  Expanded,
  /**
   * This is the content that will be displayed when the accordion is closed
   */
  Collapsed,
  /**
   * This is the content that will always be displayed
   */
  Always,
  /**
   *
   * This is a component that will add the layout transition to any
   * sibling components. Useful when you are rendering other components
   * that are not direct children of the Accordion component.
   */
  Sibling,
};

捐款

见 贡献指南 学习如何为储存库和发展工作流程作出贡献.

许可证

麻省理工学院


AnimateReactNative.com - Premium and Custom React Native animations.

版本与发布记录

@animatereactnative/accordion 共发布 6 个版本,首次发布于 2024/11/20;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.5latest2025/01/231.8 年前
0.1.42025/01/231.8 年前
0.1.32025/01/231.8 年前
0.1.22025/01/231.8 年前
0.1.12024/11/202 年前
0.1.02024/11/202 年前

关于 @animatereactnative/accordion 的常见问题

@animatereactnative/accordion 是什么?

由能渲染和动画内容具有动态高度的React Introduct Entroduct动画所提供动力.

如何安装 @animatereactnative/accordion?

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

@animatereactnative/accordion 支持 TypeScript 吗?

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

@animatereactnative/accordion 支持 ESM 还是 CommonJS?

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

@animatereactnative/accordion 可以商用吗?

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

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

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

@animatereactnative/accordion 还在维护吗?

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