Feature request: opt-in native keyboard avoidance

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

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

@Asad-Butt がすでに取り組んでいます。

2026年11月22日 から。

  • #135 @Asad-Butt による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
22/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
kotlin, react-native, swift
領域
mobile-dev

調査の方向性

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.

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

説明

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

主要言語
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 を短くまとめたダイジェスト。