Feature request: opt-in native keyboard avoidance

Aperta
#134 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Asad-Butt ci sta già lavorando.

Dal 22/11/2026.

  • #135 di @Asad-Butt — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
kotlin, react-native, swift
Ambito
mobile-dev

Direzione di ricerca

The work already exists as PR #135, so read that diff first; it adds a per-platform file for the keyboard tracking plus prop plumbing through the sheet component. Compare against the existing content detent and windowOverlay code paths the issue describes. Done means keyboardAvoidance and keyboardOffset are passed through, the sheet animates with the keyboard on iOS and frame-by-frame on Android, and nothing changes on web.

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

Descrizione

Hi, and thanks for the library!

I know keyboard handling is left to the app (#9, #66). That works well for a list inside a fixed-height sheet. It doesn't work well for a short sheet that should sit on top of the keyboard, like a small form. The sheet's position is controlled natively, so app code can only react to the keyboard after the fact:

  • Changing the detent from Keyboard events works, but the sheet moves with its own spring, not with the keyboard. On Android it only starts moving after the keyboard has finished opening.
  • react-native-keyboard-controller's layout mode changes the content height every frame, but the 'content' detent only picks up the final height. So the sheet jumps when opening and lags behind when closing.
  • React Native's automaticallyAdjustKeyboardInsets measures before the sheet moves, so the content ends up scrolled too far.

I built a small opt-in version inside the sheet to see if it works, and it does:

  • keyboardAvoidance (off by default): while an input inside the sheet is focused, the sheet moves up in the same animation as the keyboard. On iOS that's the keyboard's own animation; on Android it follows the keyboard frame by frame. Drag, snapping, detents and the scrim are not affected.
  • A tall sheet that can't move up any further gets extra bottom space in its scroll view, and the focused input is scrolled above the keyboard. Moving to the next input scrolls smoothly too.
  • keyboardOffset: an optional extra gap between the sheet and the keyboard. A negative value hides the sheet's bottom padding behind the keyboard.

It's tested on the iOS simulator and the Android emulator, including windowOverlay. It's one new file per platform plus passing the props through, and it does nothing on web.

Would you be open to a PR for this? I'm happy to change the API to whatever you prefer.

Update: I opened a PR with the implementation and recordings: #135

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.