@swmansion/react-native-bottom-sheet 0.10.2 → 0.12.0

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.
Files changed (32) hide show
  1. package/README.md +125 -25
  2. package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetPackage.kt +1 -1
  3. package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetSurfaceView.kt +10 -0
  4. package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetSurfaceViewManager.kt +27 -0
  5. package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetView.kt +97 -28
  6. package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt +11 -0
  7. package/common/cpp/react/renderer/components/ReactNativeBottomSheetSpec/ComponentDescriptors.h +4 -0
  8. package/common/cpp/react/renderer/components/ReactNativeBottomSheetSpec/ShadowNodes.h +12 -0
  9. package/ios/BottomSheetComponentView.mm +21 -2
  10. package/ios/BottomSheetContentView.h +3 -0
  11. package/ios/BottomSheetContentView.mm +15 -0
  12. package/ios/BottomSheetHostingView.swift +104 -34
  13. package/ios/BottomSheetSurfaceComponentView.h +13 -0
  14. package/ios/BottomSheetSurfaceComponentView.mm +21 -0
  15. package/lib/module/BottomSheet.js +17 -4
  16. package/lib/module/BottomSheet.js.map +1 -1
  17. package/lib/module/BottomSheetNativeComponent.ts +1 -0
  18. package/lib/module/BottomSheetSurfaceNativeComponent.ts +9 -0
  19. package/lib/module/ModalBottomSheet.js.map +1 -1
  20. package/lib/typescript/src/BottomSheet.d.ts +28 -2
  21. package/lib/typescript/src/BottomSheet.d.ts.map +1 -1
  22. package/lib/typescript/src/BottomSheetNativeComponent.d.ts +1 -0
  23. package/lib/typescript/src/BottomSheetNativeComponent.d.ts.map +1 -1
  24. package/lib/typescript/src/BottomSheetSurfaceNativeComponent.d.ts +6 -0
  25. package/lib/typescript/src/BottomSheetSurfaceNativeComponent.d.ts.map +1 -0
  26. package/lib/typescript/src/ModalBottomSheet.d.ts.map +1 -1
  27. package/package.json +20 -18
  28. package/react-native.config.js +4 -1
  29. package/src/BottomSheet.tsx +46 -1
  30. package/src/BottomSheetNativeComponent.ts +1 -0
  31. package/src/BottomSheetSurfaceNativeComponent.ts +9 -0
  32. package/src/ModalBottomSheet.tsx +4 -2
@@ -80,6 +80,11 @@
80
80
  _impl.scrimColor = color;
81
81
  }
82
82
 
83
+ - (void)setScrimOpacities:(NSArray<NSNumber *> *)opacities
84
+ {
85
+ [_impl setScrimOpacities:opacities];
86
+ }
87
+
83
88
  - (CGFloat)currentContentOffsetY
84
89
  {
85
90
  return _impl.currentContentOffsetY;
@@ -95,6 +100,16 @@
95
100
  [_impl unmountChildComponentView:childView];
96
101
  }
97
102
 
103
+ - (void)mountSurfaceComponentView:(UIView *)surfaceView atIndex:(NSInteger)index
104
+ {
105
+ [_impl mountSurfaceComponentView:surfaceView atIndex:index];
106
+ }
107
+
108
+ - (void)unmountSurfaceComponentView:(UIView *)surfaceView
109
+ {
110
+ [_impl unmountSurfaceComponentView:surfaceView];
111
+ }
112
+
98
113
  - (void)resetSheetState
99
114
  {
100
115
  [_impl resetSheetState];
@@ -34,6 +34,19 @@ public final class BottomSheetHostingView: UIView {
34
34
  didSet { scrimView.backgroundColor = scrimColor }
35
35
  }
36
36
 
37
+ /// Scrim opacity per detent index. Linearly interpolated between detents and
38
+ /// clamped to the last value for detents beyond the array. The JS layer always
39
+ /// supplies a per-detent array; the fully-opaque fallback only guards against
40
+ /// empty input (indexing requires a non-empty array).
41
+ private var scrimOpacities: [CGFloat] = [1] {
42
+ didSet { updateScrim() }
43
+ }
44
+
45
+ public func setScrimOpacities(_ values: [NSNumber]) {
46
+ let mapped = values.map { CGFloat(truncating: $0) }
47
+ scrimOpacities = mapped.isEmpty ? [1] : mapped
48
+ }
49
+
37
50
  public var maxDetentHeight: CGFloat = .nan {
38
51
  didSet { refreshDetentsFromLayout() }
39
52
  }
@@ -65,6 +78,7 @@ public final class BottomSheetHostingView: UIView {
65
78
  private var panStartingIndex: Int?
66
79
  private var isContentInteractionDisabled = false
67
80
  private var contentHeightMarker: UIView?
81
+ private weak var surfaceView: UIView?
68
82
  private static var markerObservationContext = 0
69
83
 
70
84
  override public init(frame: CGRect) {
@@ -127,10 +141,16 @@ public final class BottomSheetHostingView: UIView {
127
141
 
128
142
  scrimView.frame = bounds
129
143
  refreshDetentsFromLayout()
130
- let maxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
144
+ let maxHeight = sheetContainerHeight
131
145
  sheetContainer.bounds = CGRect(x: 0, y: 0, width: bounds.width, height: maxHeight)
132
146
  sheetContainer.center = CGPoint(x: bounds.width / 2, y: bounds.height - maxHeight / 2)
133
147
 
148
+ // The surface fills the full container so it always covers the visible sheet
149
+ // (the container is translated to the current sheet position), regardless of
150
+ // how short the content becomes. Sized from the top via frame — never via
151
+ // anchorPoint.
152
+ surfaceView?.frame = sheetContainer.bounds
153
+
134
154
  if !hasLaidOut && !detentSpecs.isEmpty {
135
155
  let indexToApply = pendingIndex ?? targetIndex
136
156
  let clampedIndex = max(0, min(detentSpecs.count - 1, indexToApply))
@@ -138,7 +158,7 @@ public final class BottomSheetHostingView: UIView {
138
158
  if animateIn, isInvalidContentDetentTarget(clampedIndex) {
139
159
  targetIndex = clampedIndex
140
160
  pendingIndex = clampedIndex
141
- let closedTy = maximumResolvedDetentHeight ?? bounds.height
161
+ let closedTy = sheetContainerHeight
142
162
  sheetContainer.transform = CGAffineTransform(translationX: 0, y: closedTy)
143
163
  emitPosition()
144
164
  return
@@ -149,7 +169,7 @@ public final class BottomSheetHostingView: UIView {
149
169
  targetIndex = clampedIndex
150
170
 
151
171
  if animateIn {
152
- let closedTy = maximumResolvedDetentHeight ?? bounds.height
172
+ let closedTy = sheetContainerHeight
153
173
  sheetContainer.transform = CGAffineTransform(translationX: 0, y: closedTy)
154
174
  emitPosition()
155
175
  snapToIndex(targetIndex, velocity: 0, emitIndexChange: false, emitSettle: true)
@@ -231,6 +251,22 @@ public final class BottomSheetHostingView: UIView {
231
251
  setNeedsLayout()
232
252
  }
233
253
 
254
+ public func mountSurfaceComponentView(_ childView: UIView, atIndex index: Int) {
255
+ surfaceView = childView
256
+ sheetContainer.insertSubview(childView, at: index)
257
+ refreshContentHeightMarker()
258
+ setNeedsLayout()
259
+ }
260
+
261
+ public func unmountSurfaceComponentView(_ childView: UIView) {
262
+ if surfaceView === childView {
263
+ surfaceView = nil
264
+ }
265
+ childView.removeFromSuperview()
266
+ refreshContentHeightMarker()
267
+ setNeedsLayout()
268
+ }
269
+
234
270
  public func resetSheetState() {
235
271
  activeAnimator?.stopAnimation(true)
236
272
  activeAnimator = nil
@@ -244,6 +280,7 @@ public final class BottomSheetHostingView: UIView {
244
280
  panStartingIndex = nil
245
281
  setContentInteractionEnabled(true)
246
282
  stopObservingContentHeightMarker()
283
+ surfaceView = nil
247
284
  sheetContainer.transform = .identity
248
285
  scrimView.alpha = 0
249
286
  scrimView.isHidden = true
@@ -260,7 +297,7 @@ public final class BottomSheetHostingView: UIView {
260
297
  }
261
298
 
262
299
  private func translationY(for index: Int) -> CGFloat {
263
- let maxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
300
+ let maxHeight = sheetContainerHeight
264
301
  let snapHeight = detent(at: index).height
265
302
  return maxHeight - snapHeight
266
303
  }
@@ -297,13 +334,13 @@ public final class BottomSheetHostingView: UIView {
297
334
  }
298
335
 
299
336
  private var currentSheetHeight: CGFloat {
300
- let maxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
337
+ let maxHeight = sheetContainerHeight
301
338
  let ty = currentTranslationY
302
339
  return maxHeight - ty
303
340
  }
304
341
 
305
342
  public var currentContentOffsetY: CGFloat {
306
- let maxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
343
+ let maxHeight = sheetContainerHeight
307
344
  let containerTop = bounds.height - maxHeight
308
345
  let ty = currentTranslationY
309
346
  return containerTop + ty
@@ -314,7 +351,7 @@ public final class BottomSheetHostingView: UIView {
314
351
  }
315
352
 
316
353
  private func emitPosition() {
317
- let maxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
354
+ let maxHeight = sheetContainerHeight
318
355
  let ty = currentTranslationY
319
356
  let position = maxHeight - ty
320
357
  updateScrim(forPosition: position)
@@ -414,7 +451,7 @@ public final class BottomSheetHostingView: UIView {
414
451
  }
415
452
 
416
453
  @objc private func handlePan(_ gesture: UIPanGestureRecognizer) {
417
- let maxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
454
+ let maxHeight = sheetContainerHeight
418
455
 
419
456
  switch gesture.state {
420
457
  case .began:
@@ -576,8 +613,14 @@ public final class BottomSheetHostingView: UIView {
576
613
  return min(max(0, maxDetentHeight), bounds.height)
577
614
  }
578
615
 
579
- private var maximumResolvedDetentHeight: CGFloat? {
580
- detentSpecs.map(\.height).max()
616
+ /// Stable coordinate base for the sheet container. The container is sized to
617
+ /// the full available height rather than the tallest detent, so it stays a
618
+ /// fixed-size canvas: when content — and thus the `content` detent — shrinks,
619
+ /// the container does not collapse underneath the sheet, leaving room to
620
+ /// animate the sheet down to its new height. The surface fills this canvas, so
621
+ /// the area below the shrunken content stays covered throughout.
622
+ private var sheetContainerHeight: CGFloat {
623
+ resolvedMaxDetentHeight
581
624
  }
582
625
 
583
626
  private func resolveDetentSpecs() -> [DetentSpec]? {
@@ -627,7 +670,7 @@ public final class BottomSheetHostingView: UIView {
627
670
  return
628
671
  }
629
672
 
630
- let previousMaxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
673
+ let previousMaxHeight = sheetContainerHeight
631
674
  // Whether the scrim is currently fully opaque, i.e. the sheet is settled at
632
675
  // or above the first non-zero detent. If so, a detent resize must not dip
633
676
  // the scrim while the sheet re-anchors to the new geometry.
@@ -642,7 +685,7 @@ public final class BottomSheetHostingView: UIView {
642
685
 
643
686
  if hasLaidOut, !isPanning {
644
687
  targetIndex = max(0, min(detentSpecs.count - 1, targetIndex))
645
- let newMaxHeight = maximumResolvedDetentHeight ?? resolvedMaxDetentHeight
688
+ let newMaxHeight = sheetContainerHeight
646
689
  let targetTy = translationY(for: targetIndex)
647
690
 
648
691
  if let animator = activeAnimator {
@@ -669,21 +712,14 @@ public final class BottomSheetHostingView: UIView {
669
712
  } else {
670
713
  let currentVisibleHeight = previousMaxHeight - currentTranslationY
671
714
  let targetHeight = detent(at: targetIndex).height
672
- let isContentDetent = rawDetentSpecs.indices.contains(targetIndex)
673
- && rawDetentSpecs[targetIndex].kind == .content
674
- let didShrink = targetHeight < currentVisibleHeight - 0.5
675
- if isContentDetent, didShrink {
676
- // Content shrank: snap immediately. Animating here would expose blank
677
- // space below the shrunken content.
678
- sheetContainer.transform = CGAffineTransform(translationX: 0, y: targetTy)
679
- emitPosition()
680
- } else if abs(targetHeight - currentVisibleHeight) <= 0.5 {
715
+ if abs(targetHeight - currentVisibleHeight) <= 0.5 {
681
716
  // No meaningful change.
682
717
  sheetContainer.transform = CGAffineTransform(translationX: 0, y: targetTy)
683
718
  emitPosition()
684
719
  } else {
685
- // Detent value changed (or content grew): re-anchor at the current
686
- // visible height, then animate to the new target.
720
+ // The content detent changed (grew or shrank): re-anchor at the
721
+ // current visible height, then animate to the new target. The surface
722
+ // covers the full sheet, so a shrink no longer exposes blank space.
687
723
  let startTy = min(max(newMaxHeight - currentVisibleHeight, 0), newMaxHeight)
688
724
  sheetContainer.transform = CGAffineTransform(translationX: 0, y: startTy)
689
725
  scrimPinnedFull = scrimPinnedFull || wasScrimFull
@@ -748,7 +784,10 @@ public final class BottomSheetHostingView: UIView {
748
784
  }
749
785
 
750
786
  private func findContentHeightMarker() -> UIView? {
751
- guard let contentView = sheetContainer.subviews.first else { return nil }
787
+ // The surface is a sibling of the content wrapper; skip it so the marker is
788
+ // always read from the content, never from the surface.
789
+ guard let contentView = sheetContainer.subviews.first(where: { $0 !== surfaceView })
790
+ else { return nil }
752
791
  return contentView.subviews.last
753
792
  }
754
793
 
@@ -834,24 +873,55 @@ private extension BottomSheetHostingView {
834
873
 
835
874
  // While the sheet is fully open and only its content/detent geometry is
836
875
  // resizing, the position momentarily lags the grown detent height. Keep the
837
- // scrim at full opacity instead of dipping it until the re-anchor settles.
876
+ // scrim pinned to the fully-open opacity instead of dipping it until the
877
+ // re-anchor settles.
838
878
  if scrimPinnedFull {
839
- scrimView.alpha = 1
840
- scrimView.isHidden = false
879
+ let opacity = fullyOpenScrimOpacity
880
+ scrimView.alpha = opacity
881
+ scrimView.isHidden = opacity <= 0.001
841
882
  return
842
883
  }
843
884
 
844
- let threshold = firstNonZeroDetentHeight
845
- let progress: CGFloat
846
- if threshold <= 0 {
847
- progress = 0
848
- } else {
849
- progress = min(1, max(0, position / threshold))
850
- }
885
+ let progress = scrimOpacity(forPosition: position)
851
886
  scrimView.alpha = progress
852
887
  scrimView.isHidden = progress <= 0.001
853
888
  }
854
889
 
890
+ /// The opacity at the tallest detent, held while the sheet re-anchors.
891
+ private var fullyOpenScrimOpacity: CGFloat {
892
+ guard let maxHeight = detentSpecs.map({ $0.height }).max() else { return 1 }
893
+ return scrimOpacity(forPosition: maxHeight)
894
+ }
895
+
896
+ /// Interpolates the scrim opacity for a sheet height by bracketing it between
897
+ /// adjacent detent heights and lerping each detent index's configured value.
898
+ private func scrimOpacity(forPosition position: CGFloat) -> CGFloat {
899
+ guard !detentSpecs.isEmpty else { return 0 }
900
+ let pairs = detentSpecs.indices
901
+ .map { (
902
+ height: detentSpecs[$0].height,
903
+ opacity: clampOpacity(scrimOpacities[min($0, scrimOpacities.count - 1)])
904
+ ) }
905
+ .sorted { $0.height < $1.height }
906
+
907
+ guard let first = pairs.first, let last = pairs.last else { return 0 }
908
+ if position <= first.height { return first.opacity }
909
+ if position >= last.height { return last.opacity }
910
+
911
+ for i in 1 ..< pairs.count where position <= pairs[i].height {
912
+ let lower = pairs[i - 1]
913
+ let upper = pairs[i]
914
+ let span = upper.height - lower.height
915
+ let t = span <= 0 ? 1 : (position - lower.height) / span
916
+ return lower.opacity + (upper.opacity - lower.opacity) * t
917
+ }
918
+ return last.opacity
919
+ }
920
+
921
+ private func clampOpacity(_ value: CGFloat) -> CGFloat {
922
+ min(1, max(0, value))
923
+ }
924
+
855
925
  func updateInteractionState() {
856
926
  scrimView.isUserInteractionEnabled = modal && (closedIndex != nil) && !scrimView.isHidden
857
927
  }
@@ -0,0 +1,13 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ // Visual surface that sits behind the sheet content. It carries no behavior of
7
+ // its own; the bottom sheet host identifies it by this type and owns its
8
+ // geometry. Its React children provide the appearance only.
9
+ @interface BottomSheetSurfaceComponentView : RCTViewComponentView
10
+
11
+ @end
12
+
13
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,21 @@
1
+ #import "BottomSheetSurfaceComponentView.h"
2
+
3
+ #import "../common/cpp/react/renderer/components/ReactNativeBottomSheetSpec/ComponentDescriptors.h"
4
+
5
+ #import <React/RCTFabricComponentsPlugins.h>
6
+
7
+ using namespace facebook::react;
8
+
9
+ @implementation BottomSheetSurfaceComponentView
10
+
11
+ + (ComponentDescriptorProvider)componentDescriptorProvider
12
+ {
13
+ return concreteComponentDescriptorProvider<BottomSheetSurfaceViewComponentDescriptor>();
14
+ }
15
+
16
+ @end
17
+
18
+ Class<RCTComponentViewProtocol> BottomSheetSurfaceViewCls(void)
19
+ {
20
+ return BottomSheetSurfaceComponentView.class;
21
+ }
@@ -3,6 +3,7 @@
3
3
  import { StyleSheet, View, useWindowDimensions } from 'react-native';
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
  import BottomSheetNativeComponent from './BottomSheetNativeComponent';
6
+ import BottomSheetSurfaceNativeComponent from './BottomSheetSurfaceNativeComponent';
6
7
  import { Portal } from "./BottomSheetProvider.js";
7
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
9
  export { programmatic } from "./bottomSheetUtils.js";
@@ -14,6 +15,7 @@ export { programmatic } from "./bottomSheetUtils.js";
14
15
  /** Native bottom sheet that renders inline within the current screen layout. */
15
16
  export const BottomSheet = ({
16
17
  children,
18
+ surface,
17
19
  style,
18
20
  detents = [0, 'content'],
19
21
  index,
@@ -23,7 +25,8 @@ export const BottomSheet = ({
23
25
  onPositionChange,
24
26
  modal = false,
25
27
  disableScrollableNegotiation = false,
26
- scrimColor
28
+ scrimColor,
29
+ scrimOpacities
27
30
  }) => {
28
31
  const {
29
32
  height: windowHeight
@@ -49,6 +52,10 @@ export const BottomSheet = ({
49
52
  const clampedIndex = Math.max(0, Math.min(index, nativeDetents.length - 1));
50
53
  const selectedDetentValue = detents[clampedIndex] ? resolveDetentValue(detents[clampedIndex]) : 0;
51
54
  const isCollapsed = selectedDetentValue === 0;
55
+ // Default the scrim opacity per detent: transparent at any closed detent,
56
+ // fully opaque at every open one. Mapping each detent independently keeps
57
+ // this correct regardless of the order detents are passed in.
58
+ const resolvedScrimOpacity = scrimOpacities ?? detents.map(detent => resolveDetentValue(detent) === 0 ? 0 : 1);
52
59
  const handleIndexChange = event => {
53
60
  onIndexChange?.(event.nativeEvent.index);
54
61
  };
@@ -65,7 +72,7 @@ export const BottomSheet = ({
65
72
  children: /*#__PURE__*/_jsx(View, {
66
73
  pointerEvents: "box-none",
67
74
  style: StyleSheet.absoluteFill,
68
- children: /*#__PURE__*/_jsx(BottomSheetNativeComponent, {
75
+ children: /*#__PURE__*/_jsxs(BottomSheetNativeComponent, {
69
76
  pointerEvents: "box-none",
70
77
  style: [{
71
78
  position: 'absolute',
@@ -84,10 +91,16 @@ export const BottomSheet = ({
84
91
  modal: modal,
85
92
  disableScrollableNegotiation: disableScrollableNegotiation,
86
93
  scrimColor: scrimColor,
94
+ scrimOpacities: resolvedScrimOpacity,
87
95
  onIndexChange: handleIndexChange,
88
96
  onSettle: handleSettle,
89
97
  onPositionChange: handlePositionChange,
90
- children: /*#__PURE__*/_jsxs(View, {
98
+ children: [surface != null && /*#__PURE__*/_jsx(BottomSheetSurfaceNativeComponent, {
99
+ collapsable: false,
100
+ pointerEvents: "box-none",
101
+ style: StyleSheet.absoluteFill,
102
+ children: surface
103
+ }), /*#__PURE__*/_jsxs(View, {
91
104
  collapsable: false,
92
105
  style: {
93
106
  flex: 1,
@@ -97,7 +110,7 @@ export const BottomSheet = ({
97
110
  collapsable: false,
98
111
  pointerEvents: "none"
99
112
  })]
100
- })
113
+ })]
101
114
  })
102
115
  })
103
116
  });
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSheet","View","useWindowDimensions","useSafeAreaInsets","BottomSheetNativeComponent","Portal","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","children","style","detents","index","animateIn","onIndexChange","onSettle","onPositionChange","modal","disableScrollableNegotiation","scrimColor","height","windowHeight","insets","maxHeight","top","nativeDetents","map","detent","isDetentProgrammatic","value","resolveDetentValue","kind","Math","max","min","clampedIndex","length","selectedDetentValue","isCollapsed","handleIndexChange","event","nativeEvent","handleSettle","handlePositionChange","position","sheet","absoluteFill","pointerEvents","left","right","bottom","maxDetentHeight","collapsable","flex"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAEA,SAASA,UAAU,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AACpE,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,SAASC,MAAM,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,SAASC,YAAY,QAAQ,uBAAoB;;AAEjD;AACA;AACA;;AA8BA;AACA,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,QAAQ;EACRC,KAAK;EACLC,OAAO,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC;EACxBC,KAAK;EACLC,SAAS,GAAG,IAAI;EAChBC,aAAa;EACbC,QAAQ;EACRC,gBAAgB;EAChBC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EAAC;UAAM,CAAE,CAAC;QAAA,CAC7C;MAAC,CACmB;IAAC,CACzB;EAAC,CACH,CACP;EAED,IAAI9B,KAAK,EAAE;IACT,oBAAOb,IAAA,CAACF,MAAM;MAAAO,QAAA,EAAEoC;IAAK,CAAS,CAAC;EACjC;EAEA,OAAOA,KAAK;AACd,CAAC;AAED,SAASjB,oBAAoBA,CAACD,MAAc,EAAW;EACrD,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjD,OAAOA,MAAM,CAACpB,YAAY,KAAK,IAAI;EACrC;EACA,OAAO,KAAK;AACd;AAEA,SAASuB,kBAAkBA,CAACH,MAAc,EAAE;EAC1C,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjD,OAAOA,MAAM,CAACE,KAAK;EACrB;EACA,OAAOF,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"names":["StyleSheet","View","useWindowDimensions","useSafeAreaInsets","BottomSheetNativeComponent","BottomSheetSurfaceNativeComponent","Portal","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","children","surface","style","detents","index","animateIn","onIndexChange","onSettle","onPositionChange","modal","disableScrollableNegotiation","scrimColor","scrimOpacities","height","windowHeight","insets","maxHeight","top","nativeDetents","map","detent","isDetentProgrammatic","value","resolveDetentValue","kind","Math","max","min","clampedIndex","length","selectedDetentValue","isCollapsed","resolvedScrimOpacity","handleIndexChange","event","nativeEvent","handleSettle","handlePositionChange","position","sheet","absoluteFill","pointerEvents","left","right","bottom","maxDetentHeight","collapsable","flex"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAEA,SAASA,UAAU,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AACpE,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,SAASC,MAAM,QAA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M,KAAK,IAAI,EAAE;IACjD,OAAOA,MAAM,CAACE,KAAK;EACrB;EACA,OAAOF,MAAM;AACf","ignoreList":[]}
@@ -19,6 +19,7 @@ export interface NativeProps extends ViewProps {
19
19
  modal: boolean;
20
20
  disableScrollableNegotiation?: boolean;
21
21
  scrimColor?: ColorValue;
22
+ scrimOpacities?: ReadonlyArray<CodegenTypes.Double>;
22
23
  onIndexChange?: CodegenTypes.DirectEventHandler<
23
24
  Readonly<{ index: CodegenTypes.Int32 }>
24
25
  >;
@@ -0,0 +1,9 @@
1
+ import { codegenNativeComponent, type ViewProps } from 'react-native';
2
+
3
+ // The visual surface that sits behind the sheet content. It carries no props of
4
+ // its own: the library identifies it by component type and owns its geometry,
5
+ // sizing it to cover the full sheet so a content shrink never exposes blank
6
+ // space. Its React children provide the visual appearance only.
7
+ export interface NativeProps extends ViewProps {}
8
+
9
+ export default codegenNativeComponent<NativeProps>('BottomSheetSurfaceView');
@@ -1 +1 @@
1
- {"version":3,"names":["BottomSheet","jsx","_jsx","ModalBottomSheet","props","modal"],"sourceRoot":"../../src","sources":["ModalBottomSheet.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAA+B,kBAAe;;AAElE;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAIA;AACA,OAAO,MAAMC,gBAAgB,GAAIC,KAA4B,iBAC3DF,IAAA,CAACF,WAAW;EAAA,GAAKI,KAAK;EAAEC,KAAK;AAAA,CAAE,CAChC","ignoreList":[]}
1
+ {"version":3,"names":["BottomSheet","jsx","_jsx","ModalBottomSheet","props","modal"],"sourceRoot":"../../src","sources":["ModalBottomSheet.tsx"],"mappings":";;AAAA,SAASA,WAAW,QAA+B,kBAAe;;AAElE;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMA;AACA,OAAO,MAAMC,gBAAgB,GAAIC,KAA4B,iBAC3DF,IAAA,CAACF,WAAW;EAAA,GAAKI,KAAK;EAAEC,KAAK;AAAA,CAAE,CAChC","ignoreList":[]}
@@ -7,8 +7,20 @@ export { programmatic } from './bottomSheetUtils';
7
7
  * Props for the inline bottom-sheet component.
8
8
  */
9
9
  export interface BottomSheetProps {
10
- /** Sheet contents, including any background or scrollable content. */
10
+ /** Sheet contents, including any scrollable content. */
11
11
  children: ReactNode;
12
+ /**
13
+ * Optional visual surface (background) rendered behind the content. The
14
+ * library sizes and positions the surface natively to cover the full sheet,
15
+ * independently of the content, so a shrinking content height never exposes
16
+ * blank space. Put a background View here instead of inside `children` when
17
+ * you want that shrink-safe behavior. When omitted, behavior is unchanged.
18
+ *
19
+ * Give the surface element a filling style such as `StyleSheet.absoluteFill`:
20
+ * it is mounted in a full-size host, so a surface sized only by its own
21
+ * content would collapse and not show.
22
+ */
23
+ surface?: ReactNode;
12
24
  /** Additional style applied to the native sheet host view. */
13
25
  style?: StyleProp<ViewStyle>;
14
26
  /** Snap points for the sheet. Defaults to `[0, 'content']`. */
@@ -33,7 +45,21 @@ export interface BottomSheetProps {
33
45
  disableScrollableNegotiation?: boolean;
34
46
  /** Scrim color used by `ModalBottomSheet`. */
35
47
  scrimColor?: string;
48
+ /**
49
+ * Scrim opacities per detent, indexed to match `detents`. Each value in 0–1
50
+ * scales the scrim color’s alpha at the detent of the same index, and the
51
+ * opacity is linearly interpolated as the sheet is dragged between detents.
52
+ * A shorter array than `detents` reuses its last value for any remaining
53
+ * detents.
54
+ *
55
+ * The default maps each detent to 0 when it is closed and 1 otherwise,
56
+ * so the scrim is transparent at any closed detent and fully opaque at every
57
+ * open one; e.g., `[0, 'content']` defaults to `[0, 1]`, and all-open detents
58
+ * default to a constant opaque scrim. Pass one value per detent—e.g.,
59
+ * `[0, 0.5, 1]`—to keep the scrim deepening across every detent.
60
+ */
61
+ scrimOpacities?: number[];
36
62
  }
37
63
  /** Native bottom sheet that renders inline within the current screen layout. */
38
- export declare const BottomSheet: ({ children, style, detents, index, animateIn, onIndexChange, onSettle, onPositionChange, modal, disableScrollableNegotiation, scrimColor, }: BottomSheetProps) => import("react/jsx-runtime").JSX.Element;
64
+ export declare const BottomSheet: ({ children, surface, style, detents, index, animateIn, onIndexChange, onSettle, onPositionChange, modal, disableScrollableNegotiation, scrimColor, scrimOpacities, }: BottomSheetProps) => import("react/jsx-runtime").JSX.Element;
39
65
  //# sourceMappingURL=BottomSheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,QAAQ,EAAE,SAAS,CAAC;IACpB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gEAAgE;IAChE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;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C,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,GAAI,sKAczB,gBAAgB,4CAwGlB,CAAC"}
@@ -12,6 +12,7 @@ export interface NativeProps extends ViewProps {
12
12
  modal: boolean;
13
13
  disableScrollableNegotiation?: boolean;
14
14
  scrimColor?: ColorValue;
15
+ scrimOpacities?: ReadonlyArray<CodegenTypes.Double>;
15
16
  onIndexChange?: CodegenTypes.DirectEventHandler<Readonly<{
16
17
  index: CodegenTypes.Int32;
17
18
  }>>;
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,KAAK,YAAY,GAAG,QAAQ,CAAC;IAC3B,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1B,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAC7C,QAAQ,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC,K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AAE,YAAY,CAAC,kBAAkB,CACxC,QAAQ,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;KAAE,CAAC,CACxC,CAAC;IACF,gBAAgB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAChD,QAAQ,CAAC;QAAE,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAA;KAAE,CAAC,CAC5C,CAAC;CACH;;AAED,wBAAsE"}
@@ -0,0 +1,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ export interface NativeProps extends ViewProps {
3
+ }
4
+ declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
5
+ export default _default;
6
+ //# sourceMappingURL=BottomSheetSurfaceNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetSurfaceNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetSurfaceNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAMtE,MAAM,WAAW,WAAY,SAAQ,SAAS;CAAG;;AAEjD,wBAA6E"}
@@ -1 +1 @@
1
- {"version":3,"file":"ModalBottomSheet.d.ts","sourceRoot":"","sources":["../../../src/ModalBottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnE,qFAAqF;AACrF,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;CAAG;AAE5C,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CAE5D,CAAC"}
1
+ {"version":3,"file":"ModalBottomSheet.d.ts","sourceRoot":"","sources":["../../../src/ModalBottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEnE,qFAAqF;AACrF,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,gBAAgB,EAChB,OAAO,CACR;CAAG;AAEJ,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CAE5D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/react-native-bottom-sheet",
3
- "version": "0.10.2",
3
+ "version": "0.12.0",
4
4
  "description": "Provides bottom-sheet components for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "!**/.*"
34
34
  ],
35
35
  "scripts": {
36
- "example": "yarn workspace @swmansion/react-native-bottom-sheet-example",
36
+ "example": "bun run --filter @swmansion/react-native-bottom-sheet-example",
37
37
  "clean": "del-cli lib",
38
38
  "prepare": "lefthook install && bob build",
39
39
  "typecheck": "tsc",
@@ -58,23 +58,23 @@
58
58
  "registry": "https://registry.npmjs.org"
59
59
  },
60
60
  "devDependencies": {
61
- "@eslint/compat": "1.4.1",
62
- "@eslint/eslintrc": "3.3.3",
63
- "@eslint/js": "9.39.2",
64
- "@react-native/babel-preset": "0.83.0",
65
- "@react-native/eslint-config": "0.83.0",
66
- "@types/react": "19.2.14",
61
+ "@eslint/compat": "2.1.0",
62
+ "@eslint/eslintrc": "3.3.5",
63
+ "@eslint/js": "9.39.4",
64
+ "@react-native/babel-preset": "0.85.3",
65
+ "@react-native/eslint-config": "0.85.3",
66
+ "@types/react": "19.2.15",
67
67
  "babel-plugin-react-compiler": "1.0.0",
68
68
  "del-cli": "6.0.0",
69
- "eslint": "9.39.2",
69
+ "eslint": "9.39.4",
70
70
  "eslint-config-prettier": "10.1.8",
71
- "eslint-plugin-prettier": "5.5.5",
72
- "lefthook": "2.1.6",
73
- "prettier": "2.8.8",
74
- "react": "19.1.0",
75
- "react-native": "0.81.5",
76
- "react-native-builder-bob": "0.40.18",
77
- "react-native-safe-area-context": "5.6.2",
71
+ "eslint-plugin-prettier": "5.5.6",
72
+ "lefthook": "2.1.9",
73
+ "prettier": "3.8.3",
74
+ "react": "19.2.3",
75
+ "react-native": "0.85.3",
76
+ "react-native-builder-bob": "0.41.0",
77
+ "react-native-safe-area-context": "5.7.0",
78
78
  "typescript": "5.9.3"
79
79
  },
80
80
  "peerDependencies": {
@@ -85,7 +85,7 @@
85
85
  "workspaces": [
86
86
  "example"
87
87
  ],
88
- "packageManager": "yarn@4.11.0",
88
+ "packageManager": "bun@1.3.14",
89
89
  "react-native-builder-bob": {
90
90
  "source": "src",
91
91
  "output": "lib",
@@ -110,7 +110,8 @@
110
110
  "jsSrcsDir": "src",
111
111
  "ios": {
112
112
  "componentProvider": {
113
- "BottomSheetView": "BottomSheetComponentView"
113
+ "BottomSheetView": "BottomSheetComponentView",
114
+ "BottomSheetSurfaceView": "BottomSheetSurfaceComponentView"
114
115
  }
115
116
  },
116
117
  "android": {
@@ -118,6 +119,7 @@
118
119
  }
119
120
  },
120
121
  "prettier": {
122
+ "proseWrap": "always",
121
123
  "quoteProps": "consistent",
122
124
  "singleQuote": true,
123
125
  "tabWidth": 2,
@@ -3,7 +3,10 @@ module.exports = {
3
3
  platforms: {
4
4
  android: {
5
5
  libraryName: 'ReactNativeBottomSheetSpec',
6
- componentDescriptors: ['BottomSheetViewComponentDescriptor'],
6
+ componentDescriptors: [
7
+ 'BottomSheetViewComponentDescriptor',
8
+ 'BottomSheetSurfaceViewComponentDescriptor',
9
+ ],
7
10
  cmakeListsPath: 'src/main/jni/CMakeLists.txt',
8
11
  },
9
12
  },