Skip to content

Make android sheet reactive to height changes #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions android/src/main/java/com/lodev09/truesheet/TrueSheetDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down