Feature request: opt-in native keyboard avoidance
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 22/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
software-mansion/react-native-bottom-sheet のほかの issue
-
Android: NoSuchElementException in ScrollIndicators.refit when a scroll view is garbage collectedオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
software-mansion/react-native-bottom-sheet#140 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
software-mansion/react-native-bottom-sheet#137 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
software-mansion/react-native-bottom-sheet#132 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
software-mansion/react-native-bottom-sheet#74 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
software-mansion/react-native-bottom-sheet#64 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
software-mansion/react-native-bottom-sheet の issue をすべて見る
似ている issue
-
Remove Collect againオープン
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
thisisartman/Meguri#211 ·
メンテナーはふだん 1 日以内に返信
-
follow-up
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
area:android fleet
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
emm3000/myGame#2175 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信