[Feature request] Native footer slot pinned to the sheet's visible bottom edge

オープン
#62 コメント 1 件 リアクション 6 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
react-native
領域
mobile

調査の方向性

Start by tracing the existing surface slot and content-region inset implementation, then inspect the native positioning path that keeps the sheet aligned during dragging, snapping, resizing, and keyboard avoidance. Define how a footer prop would integrate with those paths and with detached sheets. Done means the footer remains pinned without Reanimated and content can scroll above it.

索引モデルが issue の本文から書いたものです。

説明

What

A footer prop on BottomSheet / ModalBottomSheet — a sibling to the existing surface slot — that renders a React-composed view pinned to the sheet's visible bottom edge natively, staying frame-perfect while the sheet is dragged, snapped, or resized.

<BottomSheet
  index={index}
  onIndexChange={setIndex}
  surface={/* ... */}
  footer={
    <View style={styles.footer}>
      <Button title="Confirm" onPress={onConfirm} />
    </View>
  }
>
  {/* scrollable content */}
</BottomSheet>

Ideally the content region would also account for the footer's height (similar to how the content-region inset works today), so scrollables inside the sheet can scroll their last items above the footer rather than behind it.

Why

A fixed action area (confirm/cancel buttons, a total-price bar, a "add to cart" CTA) is one of the most common bottom-sheet compositions, and there is currently no first-class way to build one:

  • Absolutely positioning a footer inside the sheet content doesn't work during drags: the sheet container is translated natively, so a content-anchored footer moves off-screen with it as the sheet collapses, and content-size updates go through the shadow tree asynchronously.
  • The documented position-tracking approach (onPositionChange + wrapNativeView={Animated.createAnimatedComponent} + a useEvent worklet) can counter-translate a footer on the UI thread, and it works well — but it reintroduces a Reanimated dependency and per-frame handler work for what is arguably core sheet composition. Not requiring Reanimated is one of this library's stated advantages over @gorhom/bottom-sheet.
  • Rendering the footer outside the sheet as a screen-bottom sibling loses modal layering (it sits below the scrim/portal), keyboard avoidance, and show/hide coordination with the sheet.

For comparison, @gorhom/bottom-sheet ships BottomSheetFooter for exactly this reason, and it's one of its most-used building blocks. Since this library already moves positioning into native code and already has the surface slot precedent, a natively pinned footer seems like a natural fit for the architecture: the native host knows the visible bottom edge every frame (including during springs and keyboard avoidance), so it can hold the footer there with no JS involvement.

Things that would need defining (happy to discuss):

  • Interaction with keyboard avoidance — presumably the footer rides above the keyboard with the sheet.
  • Interaction with the detached / floating-card sheets proposed in #58, where the visible bottom edge is lifted by bottomInset.
  • Whether the footer's height feeds 'content' detent sizing.

If this sounds reasonable, I'd be glad to help test it, or take a shot at a PR if maintainers can offer some pointers on the preferred native approach.

主要言語
Kotlin
スター
536
フォーク
24
平均マージ
12時間 10分
マージ済み PR(30日)
22

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

software-mansion/react-native-bottom-sheet のほかの issue

software-mansion/react-native-bottom-sheet の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。