From 15d3aad31a14f39ac1cb7384d18e3ca18971834b Mon Sep 17 00:00:00 2001 From: Sean Holbert Date: Tue, 10 Nov 2026 12:54:20 -0800 Subject: [PATCH 1/4] fix(android): don't count the keyboard against maxContentHeight getDetentHeight added the keyboard inset to the detent height and then applied maxContentHeight, so the keyboard used up the content cap. A sheet whose content plus keyboard exceeded maxContentHeight stopped at the cap and the keyboard covered the bottom of its content, e.g. a submit button below a text input. iOS caps the content and lifts the sheet above the keyboard. Cap the content height first, then add the keyboard, still clamped to the screen. With no keyboard the result is unchanged. Co-Authored-By: Claude Opus 5.5 --- .../lodev09/truesheet/core/TrueSheetDetentCalculator.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt b/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt index b0aec41b2..e12c3af01 100644 --- a/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +++ b/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt @@ -132,9 +132,11 @@ class TrueSheetDetentCalculator(private val reactContext: ThemedReactContext) { } else { 0 } - val height = baseHeight + keyboardHeight - footerKeyboardOverlap - val maxAllowedHeight = screenHeight + contentBottomInset - return maxContentHeight?.let { minOf(height, it, maxAllowedHeight) } ?: minOf(height, maxAllowedHeight) + // maxContentHeight caps the content; the keyboard lifts the sheet on top of it, as on iOS. + val contentHeight = (baseHeight - footerKeyboardOverlap).let { height -> + maxContentHeight?.let { minOf(height, it) } ?: height + } + return minOf(contentHeight + keyboardHeight, screenHeight + contentBottomInset) } fun getBackgroundIndex(sheetTop: Int, displayedIndex: Int): Int { From cb73fc902405e8d3ba259abc251fe5c3aa4a001a Mon Sep 17 00:00:00 2001 From: Sean Holbert Date: Tue, 10 Nov 2026 13:17:48 -0800 Subject: [PATCH 2/4] docs: add changelog entry for #1017 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a868a3702..3c61ea8f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### 🐛 Bug fixes + +- **Android**: `maxContentHeight` now caps the sheet's content without the keyboard, as on iOS. The keyboard used to count against it, so a sheet whose content plus keyboard was taller than `maxContentHeight` stopped at the cap and the keyboard covered the bottom of its content, such as a button below a text input. ([#1017](https://github.com/lodev09/react-native-true-sheet/pull/1017) by [@wildseansy](https://github.com/wildseansy)) + ### 💡 Others - The Expo example in `example/expo` now runs SDK 58, and the SDK 57 example moves to `example/expo-57` (`yarn expo-57`). The bare example is upgraded to React Native 0.88. ([#1016](https://github.com/lodev09/react-native-true-sheet/pull/1016) by [@lodev09](https://github.com/lodev09)) From 746f5e16b598a6e49e6f2636f42ac1250c338496 Mon Sep 17 00:00:00 2001 From: Jovanni Lo Date: Tue, 17 Nov 2026 00:08:40 +0800 Subject: [PATCH 3/4] refactor(android): simplify the maxContentHeight cap --- .../com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt b/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt index e12c3af01..da2b59692 100644 --- a/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +++ b/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt @@ -133,10 +133,8 @@ class TrueSheetDetentCalculator(private val reactContext: ThemedReactContext) { 0 } // maxContentHeight caps the content; the keyboard lifts the sheet on top of it, as on iOS. - val contentHeight = (baseHeight - footerKeyboardOverlap).let { height -> - maxContentHeight?.let { minOf(height, it) } ?: height - } - return minOf(contentHeight + keyboardHeight, screenHeight + contentBottomInset) + val cappedHeight = minOf(baseHeight - footerKeyboardOverlap, maxContentHeight ?: Int.MAX_VALUE) + return minOf(cappedHeight + keyboardHeight, screenHeight + contentBottomInset) } fun getBackgroundIndex(sheetTop: Int, displayedIndex: Int): Int { From af27a14bebf6732350c25a8f408bb98c925b5003 Mon Sep 17 00:00:00 2001 From: Jovanni Lo Date: Tue, 17 Nov 2026 00:08:41 +0800 Subject: [PATCH 4/4] docs: update changelog entry for #1017 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33b2337cc..9270d9ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - **Android**: A sheet whose keyboard starts rising as the present slide ends, such as one that focuses an input around `onWillPresent`, now finishes presenting. It used to never fire `onDidPresent` or resolve `present()`, and kept swallowing taps. ([#1012](https://github.com/lodev09/react-native-true-sheet/pull/1012) by [@JacquesLeupin](https://github.com/JacquesLeupin)) - **Android**: When a sheet presented over another sheet changes its content size right before it dismisses, the sheet behind it now slides back instead of staying pushed down and not draggable. ([#1015](https://github.com/lodev09/react-native-true-sheet/pull/1015) by [@idlework](https://github.com/idlework)) -- **Android**: `maxContentHeight` now caps the sheet's content without the keyboard, as on iOS. The keyboard used to count against it, so a sheet whose content plus keyboard was taller than `maxContentHeight` stopped at the cap and the keyboard covered the bottom of its content, such as a button below a text input. ([#1017](https://github.com/lodev09/react-native-true-sheet/pull/1017) by [@wildseansy](https://github.com/wildseansy)) +- **Android**: The keyboard no longer counts against `maxContentHeight`, as on iOS. A sheet now rises above the keyboard instead of stopping at `maxContentHeight` with the keyboard covering the bottom of its content, such as a button below a text input. A sheet already at `maxContentHeight` now rises with the keyboard too, instead of staying put. ([#1017](https://github.com/lodev09/react-native-true-sheet/pull/1017) by [@wildseansy](https://github.com/wildseansy)) ### 💡 Others