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

Aperta
#62 1 commento 6 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
react-native
Ambito
mobile

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Kotlin
Stelle
536
Fork
24
Merge medio
12h 10m
PR unite (30g)
22

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di software-mansion/react-native-bottom-sheet

Tutte le issue di software-mansion/react-native-bottom-sheet

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.