@swmansion/react-native-bottom-sheet 0.9.4 → 0.9.5
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.
|
@@ -260,12 +260,13 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
260
260
|
|
|
261
261
|
private fun resolveDetentSpecs(): List<DetentSpec> {
|
|
262
262
|
val maxHeight = resolvedMaxDetentHeight()
|
|
263
|
-
val contentHeight =
|
|
263
|
+
val contentHeight =
|
|
264
|
+
validContentHeight().takeIf { it.isFinite() }?.coerceAtMost(maxHeight) ?: maxHeight
|
|
264
265
|
return rawDetentSpecs.map { spec ->
|
|
265
266
|
val height =
|
|
266
267
|
when (spec.kind) {
|
|
267
|
-
DetentKind.POINTS -> spec.value
|
|
268
|
-
DetentKind.CONTENT -> contentHeight
|
|
268
|
+
DetentKind.POINTS -> spec.value.coerceAtMost(contentHeight)
|
|
269
|
+
DetentKind.CONTENT -> contentHeight
|
|
269
270
|
}.coerceIn(0f, maxHeight)
|
|
270
271
|
DetentSpec(height = height, programmatic = spec.programmatic)
|
|
271
272
|
}
|
|
@@ -451,6 +452,7 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
451
452
|
}
|
|
452
453
|
|
|
453
454
|
val targetTy = translationY(index)
|
|
455
|
+
val currentTy = sheetContainer.translationY
|
|
454
456
|
activeAnimationEmitsSettle = emitSettle
|
|
455
457
|
activeAnimation?.cancel()
|
|
456
458
|
|
|
@@ -461,8 +463,8 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
461
463
|
dampingRatio = SpringForce.DAMPING_RATIO_NO_BOUNCY
|
|
462
464
|
stiffness = SpringForce.STIFFNESS_MEDIUM
|
|
463
465
|
}
|
|
464
|
-
setMinValue(minDetentTranslationY)
|
|
465
|
-
setMaxValue(maxDetentTranslationY)
|
|
466
|
+
setMinValue(minOf(minDetentTranslationY, currentTy, targetTy))
|
|
467
|
+
setMaxValue(maxOf(maxDetentTranslationY, currentTy, targetTy))
|
|
466
468
|
setStartVelocity(velocity)
|
|
467
469
|
addEndListener { _, canceled, _, _ ->
|
|
468
470
|
if (canceled) {
|
|
@@ -130,7 +130,7 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
130
130
|
let indexToApply = pendingIndex ?? targetIndex
|
|
131
131
|
let clampedIndex = max(0, min(detentSpecs.count - 1, indexToApply))
|
|
132
132
|
|
|
133
|
-
if animateIn
|
|
133
|
+
if animateIn, isInvalidContentDetentTarget(clampedIndex) {
|
|
134
134
|
targetIndex = clampedIndex
|
|
135
135
|
pendingIndex = clampedIndex
|
|
136
136
|
let closedTy = maximumResolvedDetentHeight ?? bounds.height
|
|
@@ -546,7 +546,7 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
546
546
|
let height: CGFloat
|
|
547
547
|
switch spec.kind {
|
|
548
548
|
case .points:
|
|
549
|
-
height = spec.value
|
|
549
|
+
height = min(spec.value, contentHeight)
|
|
550
550
|
case .content:
|
|
551
551
|
height = contentHeight
|
|
552
552
|
}
|
package/package.json
CHANGED