@delacour/react-native-bottom-sheet

中文文档
0.9.0发布于 2026/11/11MITES Module零依赖构建来源已验证近 30 天下载 1.3万

Headless bottom sheet engine for React Native — no tokens, no className

原始使用文档
文档目录5 节
  1. Install
  2. Providers
  3. Anatomy
  4. The maths on its own
  5. Licence

@delacour/react-native-bottom-sheet

A headless bottom sheet engine for React Native — Gesture Handler for the pans, Reanimated for the motion, keyboard-controller for the keyboard, teleport for the portal.

No tokens, no className, no theme. Every radius, colour and inset is a style you pass in. If you want a sheet already wearing a design system, use @delacour/react-native-ui/bottom-sheet, which is this engine with the tokens attached.

Documentation: ui.delacour.co.nz/docs/bottom-sheet.

Alpha. This package, @delacour/react-native-ui and @delacour/react-native-charts publish to npm's alpha tag, and every alpha is also latest.

Install

bun add @delacour/react-native-bottom-sheet@alpha
bunx expo install react-native-gesture-handler react-native-reanimated react-native-worklets react-native-keyboard-controller react-native-safe-area-context react-native-teleport

The native peers go through expo install, so the SDK picks versions it can build; react and react-native are already in any app.

Fabric only, dev client only. react-native-teleport moves native views between hosts, which needs the new architecture — the default since React Native 0.76 and the only architecture in Expo SDK 53 and later. It is a native module, so it does not run in Expo Go: build a dev client (npx expo run:ios, or an EAS development build) and rebuild it after installing.

PeerRangeWhy
react>=19Ref-as-prop
react-native>=0.88Fabric getBoundingClientRect
react-native-gesture-handler>=3.3The handle and content pans
react-native-reanimated>=4Every animated value
react-native-worklets>=0.5scheduleOnRN from the UI thread
react-native-keyboard-controller>=1.18The only keyboard source — frame-accurate height and progress
react-native-safe-area-context>=5The bottom band under a sticky footer
react-native-teleport>=1.2The portal — the React tree stays put, so context reaches every part

The package has no runtime dependencies of its own.

Providers

Your app mounts four, in this order. The package renders only the last — a nested gesture root is dead weight, and a nested KeyboardProvider is a second keyboard that disagrees with the first.

import { BottomSheetProvider } from "@delacour/react-native-bottom-sheet";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { KeyboardProvider } from "react-native-keyboard-controller";
import { initialWindowMetrics, SafeAreaProvider } from "react-native-safe-area-context";

<GestureHandlerRootView style={{ flex: 1 }}>
  <SafeAreaProvider initialMetrics={initialWindowMetrics}>
    <KeyboardProvider>
      <BottomSheetProvider>{children}</BottomSheetProvider>
    </KeyboardProvider>
  </SafeAreaProvider>
</GestureHandlerRootView>;

BottomSheetProvider is the root host every sheet teleports to, so a sheet draws over the navigator wherever it was written. Without it a Portal renders where it is written, as an inline sheet.

Anatomy

import { BottomSheet } from "@delacour/react-native-bottom-sheet";

<BottomSheet snapPoints={["40%", "90%"]}>
  <BottomSheet.Trigger>
    <Text>Open</Text>
  </BottomSheet.Trigger>
  <BottomSheet.Portal>
    <BottomSheet.Overlay style={{ backgroundColor: "rgba(0,0,0,0.4)" }} />
    <BottomSheet.Container>
      <BottomSheet.Background style={{ backgroundColor: "#fff", borderTopLeftRadius: 16, borderTopRightRadius: 16 }} />
      <BottomSheet.Handle style={{ alignItems: "center", paddingVertical: 12 }}>
        <View style={{ width: 36, height: 5, borderRadius: 3, backgroundColor: "#ccc" }} />
      </BottomSheet.Handle>
      <BottomSheet.Content style={{ padding: 16 }}>
        <BottomSheet.Title>Filters</BottomSheet.Title>
        <BottomSheet.Description>Narrow the list down.</BottomSheet.Description>
        <BottomSheet.TextInput placeholder="Search" />
        <BottomSheet.Close>
          <Text>Close</Text>
        </BottomSheet.Close>
      </BottomSheet.Content>
      <BottomSheet.Footer padding={16}>
        <Button title="Apply" onPress={apply} />
      </BottomSheet.Footer>
    </BottomSheet.Container>
  </BottomSheet.Portal>
</BottomSheet>;

Container is the panel that moves; Content is the static body inside it. Swap the body for BottomSheet.ScrollView, FlatList or SectionList and the list's content size becomes the sheet's own snap point; swap it for BottomSheet.Steps with a controller from useSheetMachine and the sheet's height glides between the steps of a typed machine. Footer is sticky by default, standing on the safe-area band and riding the keyboard's edge. <BottomSheet.Portal inline> renders in place; <BottomSheet.Host name> gives a native modal a target of its own; detached floats the sheet as a card.

Sizing and behaviour — snapPoints, dynamicSizing, maxDynamicContentSize, keyboardBehavior, detached, the haptic worklet props — are the root's. Every part takes style and ref, and the parts that render text or a press take asChild to hand their behaviour to an element of yours.

The maths on its own

@delacour/react-native-bottom-sheet/core is every snap point, keyboard, footer and geometry calculation in the package, plus the step machine, importable with no native module in the module graph:

import { defineSheetMachine, positionFor, UNMEASURED } from "@delacour/react-native-bottom-sheet/core";

Licence

MIT

版本与发布记录

@delacour/react-native-bottom-sheet 共发布 86 个版本,首次发布于 2026/10/04;过去 12 个月发布了 86 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.0latest2026/11/111 天前
0.9.0-alpha.20261110170610alpha2026/11/111 天前
0.9.0-alpha.202611092058422026/11/102 天前
0.9.0-alpha.202611092057322026/11/102 天前
0.9.0-alpha.202611092050532026/11/102 天前
0.9.0-alpha.202611092017592026/11/102 天前

关于 @delacour/react-native-bottom-sheet 的常见问题

@delacour/react-native-bottom-sheet 是什么?

Headless bottom sheet engine for React Native — no tokens, no className

如何安装 @delacour/react-native-bottom-sheet?

在项目目录运行 npm install @delacour/react-native-bottom-sheet,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=19)、react-native(>=0.88)、react-native-teleport(>=1.2)、react-native-worklets(>=0.5)、react-native-reanimated(>=4)、react-native-gesture-handler(>=3.3)、react-native-safe-area-context(>=5)、react-native-keyboard-controller(>=1.18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@delacour/react-native-bottom-sheet 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/delacour__react-native-bottom-sheet 是否存在。

@delacour/react-native-bottom-sheet 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@delacour/react-native-bottom-sheet 可以商用吗?

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

@delacour/react-native-bottom-sheet 的下载量有多少?

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

@delacour/react-native-bottom-sheet 还在维护吗?

最新版本 0.9.0 发布于 2026/11/11(1 天前);至今共发布 86 个版本,其中过去 12 个月发布了 86 个;首次发布于 2026/10/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。