From aa93f92f5d67224441a5710d3006065fbe04770b Mon Sep 17 00:00:00 2001 From: Arthur Delbeke Date: Tue, 1 Jul 2025 09:25:58 +0200 Subject: [PATCH] fix(TrueSheetDialog): update content height handling for auto size --- .../com/lodev09/truesheet/TrueSheetDialog.kt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt b/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt index f4b38fc..4611f18 100644 --- a/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt +++ b/android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt @@ -52,6 +52,28 @@ class TrueSheetDialog(private val reactContext: ThemedReactContext, private val var maxScreenHeight = 0 var contentHeight = 0 + set(value) { + val oldValue = field + field = value + + // If height changed and using auto size, reconfigure + if (oldValue != value && sizes.size == 1 && sizes[0] == "auto" && isShowing) { + // Force a layout update + sheetContainerView?.let { container -> + val params = container.layoutParams + params.height = value + footerHeight + container.layoutParams = params + } + + configure() + + // Force expanded state to ensure proper height + behavior.apply { + maxHeight = value + footerHeight + state = BottomSheetBehavior.STATE_EXPANDED + } + } + } var footerHeight = 0 var maxSheetHeight: Int? = null