@swmansion/react-native-bottom-sheet 0.8.1 → 0.8.2
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.
|
@@ -581,6 +581,14 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
581
581
|
return
|
|
582
582
|
}
|
|
583
583
|
|
|
584
|
+
// When settled at the closed detent, dynamic content updates can briefly
|
|
585
|
+
// produce stale non-zero positions. Keep scrim hidden in this state.
|
|
586
|
+
if (closedIndex != null && targetIndex == closedIndex && activeAnimation == null && !isPanning) {
|
|
587
|
+
scrimProgress = 0f
|
|
588
|
+
invalidate()
|
|
589
|
+
return
|
|
590
|
+
}
|
|
591
|
+
|
|
584
592
|
val threshold = firstNonZeroDetentHeight
|
|
585
593
|
scrimProgress =
|
|
586
594
|
if (threshold <= 0f) 0f else (position / threshold).coerceIn(0f, 1f)
|
|
@@ -601,7 +609,7 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
601
609
|
return maxHeight - sheetContainer.translationY
|
|
602
610
|
}
|
|
603
611
|
|
|
604
|
-
private fun isScrimVisible(): Boolean = modal &&
|
|
612
|
+
private fun isScrimVisible(): Boolean = modal && scrimProgress > 0.001f
|
|
605
613
|
|
|
606
614
|
private fun drawScrim(canvas: Canvas) {
|
|
607
615
|
if (!modal || scrimProgress <= 0.001f) {
|
|
@@ -272,7 +272,7 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
private var isScrimVisible: Bool {
|
|
275
|
-
modal &&
|
|
275
|
+
modal && !scrimView.isHidden
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
private func emitPosition() {
|
|
@@ -523,6 +523,19 @@ private extension RNSBottomSheetHostingView {
|
|
|
523
523
|
return
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
+
// If we're settled on the closed detent, dynamic detent/content updates can
|
|
527
|
+
// momentarily report a stale non-zero position. Keep scrim fully hidden.
|
|
528
|
+
if
|
|
529
|
+
let closedIndex,
|
|
530
|
+
targetIndex == closedIndex,
|
|
531
|
+
activeAnimator == nil,
|
|
532
|
+
!isPanning
|
|
533
|
+
{
|
|
534
|
+
scrimView.alpha = 0
|
|
535
|
+
scrimView.isHidden = true
|
|
536
|
+
return
|
|
537
|
+
}
|
|
538
|
+
|
|
526
539
|
let threshold = firstNonZeroDetentHeight
|
|
527
540
|
let progress: CGFloat
|
|
528
541
|
if threshold <= 0 {
|
package/package.json
CHANGED