@momo-kits/native-kits 0.167.1-duo.10-debug → 0.167.1-duo.11-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/compose/build.gradle.kts
CHANGED
|
@@ -291,8 +291,9 @@ struct BottomSheetView<Content: View>: View {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
/// Compose's `heightIn(max:)
|
|
295
|
-
///
|
|
294
|
+
/// Compose's `heightIn(max:)`. `.frame(maxHeight:)` grows to the cap whenever the proposal is
|
|
295
|
+
/// larger, leaving a gap above the header; this sizes the sheet to its content and only caps it
|
|
296
|
+
/// when taller.
|
|
296
297
|
@available(iOS 16.0, *)
|
|
297
298
|
private struct CapHeight: ViewModifier {
|
|
298
299
|
let maxHeight: CGFloat
|
|
@@ -307,8 +308,11 @@ private struct CapHeightLayout: Layout {
|
|
|
307
308
|
let maxHeight: CGFloat
|
|
308
309
|
|
|
309
310
|
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
|
|
310
|
-
let
|
|
311
|
-
|
|
311
|
+
guard let subview = subviews.first else { return .zero }
|
|
312
|
+
let cap = min(maxHeight, proposal.height ?? .infinity)
|
|
313
|
+
// ideal first: a scroll view would otherwise fill whatever height it is offered
|
|
314
|
+
let ideal = subview.sizeThatFits(ProposedViewSize(width: proposal.width, height: nil))
|
|
315
|
+
return subview.sizeThatFits(ProposedViewSize(width: proposal.width, height: min(ideal.height, cap)))
|
|
312
316
|
}
|
|
313
317
|
|
|
314
318
|
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
|