@swmansion/react-native-bottom-sheet 0.15.0-next.5 → 0.15.0-next.7
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/README.md +25 -2
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetHostView.kt +979 -0
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetView.kt +347 -858
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt +7 -1
- package/ios/BottomSheetComponentView.mm +149 -0
- package/ios/BottomSheetContentView.h +1 -0
- package/ios/BottomSheetContentView.mm +5 -0
- package/ios/BottomSheetHostingView.swift +34 -10
- package/lib/module/BottomSheet.js +26 -16
- package/lib/module/BottomSheet.js.map +1 -1
- package/lib/module/BottomSheetNativeComponent.ts +1 -0
- package/lib/module/ModalBottomSheet.js +12 -5
- package/lib/module/ModalBottomSheet.js.map +1 -1
- package/lib/typescript/src/BottomSheet.d.ts +17 -8
- package/lib/typescript/src/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetNativeComponent.d.ts +1 -0
- package/lib/typescript/src/BottomSheetNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/ModalBottomSheet.d.ts +36 -2
- package/lib/typescript/src/ModalBottomSheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BottomSheet.tsx +45 -23
- package/src/BottomSheetNativeComponent.ts +1 -0
- package/src/ModalBottomSheet.tsx +50 -8
package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt
CHANGED
|
@@ -59,7 +59,7 @@ class BottomSheetViewManager :
|
|
|
59
59
|
private fun dispatchEvent(view: BottomSheetView, eventName: String, eventData: WritableMap) {
|
|
60
60
|
val reactContext = UIManagerHelper.getReactContext(view)
|
|
61
61
|
val surfaceId = UIManagerHelper.getSurfaceId(view)
|
|
62
|
-
UIManagerHelper.
|
|
62
|
+
UIManagerHelper.getEventDispatcher(reactContext)
|
|
63
63
|
?.dispatchEvent(BottomSheetEvent(surfaceId, view.id, eventName, eventData))
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -82,6 +82,7 @@ class BottomSheetViewManager :
|
|
|
82
82
|
stateWrapper: StateWrapper?,
|
|
83
83
|
): Any? {
|
|
84
84
|
view.stateWrapper = stateWrapper
|
|
85
|
+
view.eventDispatcher = UIManagerHelper.getEventDispatcher(UIManagerHelper.getReactContext(view))
|
|
85
86
|
return null
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -132,6 +133,11 @@ class BottomSheetViewManager :
|
|
|
132
133
|
view.modal = modal
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
@ReactProp(name = "nativeOverlay")
|
|
137
|
+
override fun setNativeOverlay(view: BottomSheetView, value: Boolean) {
|
|
138
|
+
view.setNativeOverlay(value)
|
|
139
|
+
}
|
|
140
|
+
|
|
135
141
|
@ReactProp(name = "disableScrollableNegotiation")
|
|
136
142
|
override fun setDisableScrollableNegotiation(view: BottomSheetView, value: Boolean) {
|
|
137
143
|
view.disableScrollableNegotiation = value
|
|
@@ -7,12 +7,47 @@
|
|
|
7
7
|
#import <React/RCTAssert.h>
|
|
8
8
|
#import <React/RCTConversions.h>
|
|
9
9
|
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
#import <React/RCTSurfaceTouchHandler.h>
|
|
10
11
|
#import <react/renderer/components/ReactNativeBottomSheetSpec/EventEmitters.h>
|
|
11
12
|
#import <react/renderer/components/ReactNativeBottomSheetSpec/Props.h>
|
|
12
13
|
#import <react/renderer/components/ReactNativeBottomSheetSpec/RCTComponentViewHelpers.h>
|
|
13
14
|
|
|
14
15
|
using namespace facebook::react;
|
|
15
16
|
|
|
17
|
+
/// Full-window container hosting the sheet in native-overlay mode. It is added
|
|
18
|
+
/// directly to the host `UIWindow` (above any modal presented in that window)
|
|
19
|
+
/// and forwards hit-testing to its single subview—the sheet—so touches outside
|
|
20
|
+
/// the sheet and its scrim fall through to the content underneath.
|
|
21
|
+
@interface BottomSheetOverlayContainerView : UIView
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation BottomSheetOverlayContainerView
|
|
25
|
+
|
|
26
|
+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
|
27
|
+
{
|
|
28
|
+
if (!self.isUserInteractionEnabled || self.isHidden || self.alpha < 0.01) {
|
|
29
|
+
return nil;
|
|
30
|
+
}
|
|
31
|
+
// Bypass UIKit's strict containment policy and hit-test subviews directly: the
|
|
32
|
+
// sheet's own hitTest returns nil outside the sheet/scrim, which is how a tap
|
|
33
|
+
// on empty space passes through to whatever sits below the overlay.
|
|
34
|
+
for (UIView *subview in [self.subviews reverseObjectEnumerator]) {
|
|
35
|
+
CGPoint convertedPoint = [subview convertPoint:point fromView:self];
|
|
36
|
+
UIView *hit = [subview hitTest:convertedPoint withEvent:event];
|
|
37
|
+
if (hit != nil) {
|
|
38
|
+
return hit;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return nil;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
|
|
45
|
+
{
|
|
46
|
+
return [self hitTest:point withEvent:event] != nil;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@end
|
|
50
|
+
|
|
16
51
|
@interface BottomSheetComponentView () <BottomSheetContentViewDelegate>
|
|
17
52
|
@end
|
|
18
53
|
|
|
@@ -21,6 +56,9 @@ using namespace facebook::react;
|
|
|
21
56
|
State::Shared _sheetState;
|
|
22
57
|
float _lastContentOffsetY;
|
|
23
58
|
BOOL _needsIndexSyncAfterRecycle;
|
|
59
|
+
BOOL _nativeOverlay;
|
|
60
|
+
BottomSheetOverlayContainerView *_overlayContainer;
|
|
61
|
+
RCTSurfaceTouchHandler *_overlayTouchHandler;
|
|
24
62
|
}
|
|
25
63
|
|
|
26
64
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
@@ -34,6 +72,7 @@ using namespace facebook::react;
|
|
|
34
72
|
static const auto defaultProps = std::make_shared<const BottomSheetViewProps>();
|
|
35
73
|
_props = defaultProps;
|
|
36
74
|
_needsIndexSyncAfterRecycle = NO;
|
|
75
|
+
_nativeOverlay = NO;
|
|
37
76
|
|
|
38
77
|
_sheetView = [[BottomSheetContentView alloc] initWithFrame:CGRectZero];
|
|
39
78
|
_sheetView.delegate = self;
|
|
@@ -78,6 +117,11 @@ using namespace facebook::react;
|
|
|
78
117
|
_sheetView.modal = newViewProps.modal;
|
|
79
118
|
}
|
|
80
119
|
|
|
120
|
+
if (newViewProps.nativeOverlay != oldViewProps.nativeOverlay) {
|
|
121
|
+
_nativeOverlay = newViewProps.nativeOverlay;
|
|
122
|
+
[self updateOverlayPresentation];
|
|
123
|
+
}
|
|
124
|
+
|
|
81
125
|
if (newViewProps.disableScrollableNegotiation != oldViewProps.disableScrollableNegotiation) {
|
|
82
126
|
_sheetView.disableScrollableNegotiation = newViewProps.disableScrollableNegotiation;
|
|
83
127
|
}
|
|
@@ -102,6 +146,105 @@ using namespace facebook::react;
|
|
|
102
146
|
_sheetState = state;
|
|
103
147
|
}
|
|
104
148
|
|
|
149
|
+
- (void)didMoveToWindow
|
|
150
|
+
{
|
|
151
|
+
[super didMoveToWindow];
|
|
152
|
+
// Attach once a window is available, detach when leaving it. The window is the
|
|
153
|
+
// anchor for the overlay container, so its lifecycle gates presentation.
|
|
154
|
+
if (_nativeOverlay || _overlayContainer != nil) {
|
|
155
|
+
[self updateOverlayPresentation];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/// Reconciles where the sheet view is parented with the current `nativeOverlay`
|
|
160
|
+
/// flag and window availability: hoisted into a full-window container attached to
|
|
161
|
+
/// the host window when on, restored as our own `contentView` when off.
|
|
162
|
+
- (void)updateOverlayPresentation
|
|
163
|
+
{
|
|
164
|
+
UIWindow *window = self.window;
|
|
165
|
+
|
|
166
|
+
if (!_nativeOverlay) {
|
|
167
|
+
if (_overlayContainer != nil) {
|
|
168
|
+
[self restoreInlinePresentation];
|
|
169
|
+
}
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (window != nil) {
|
|
174
|
+
if (_overlayContainer == nil) {
|
|
175
|
+
_overlayContainer = [[BottomSheetOverlayContainerView alloc] initWithFrame:window.bounds];
|
|
176
|
+
_overlayContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
177
|
+
}
|
|
178
|
+
if (_overlayTouchHandler == nil) {
|
|
179
|
+
// Touches inside the container sit outside the RN root view's touch
|
|
180
|
+
// handler, so attach a dedicated surface touch handler to dispatch them to
|
|
181
|
+
// JS (e.g. Pressables in the sheet). It also satisfies the sheet's
|
|
182
|
+
// ancestor "TouchHandler" lookup used to cancel touches on a drag.
|
|
183
|
+
_overlayTouchHandler = [RCTSurfaceTouchHandler new];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (_sheetView.superview != _overlayContainer) {
|
|
187
|
+
if (self.contentView == _sheetView) {
|
|
188
|
+
self.contentView = nil;
|
|
189
|
+
}
|
|
190
|
+
_overlayContainer.frame = window.bounds;
|
|
191
|
+
[_overlayContainer addSubview:_sheetView];
|
|
192
|
+
_sheetView.frame = _overlayContainer.bounds;
|
|
193
|
+
}
|
|
194
|
+
if (_overlayContainer.window != window) {
|
|
195
|
+
[self detachOverlayTouchHandler];
|
|
196
|
+
[_overlayContainer removeFromSuperview];
|
|
197
|
+
// Added as the topmost window subview so it floats above modal content in
|
|
198
|
+
// the same window. With multiple native-overlay sheets active at once, the
|
|
199
|
+
// last one presented wins the z-order; the feature assumes a single overlay
|
|
200
|
+
// sheet visible at a time.
|
|
201
|
+
[window addSubview:_overlayContainer];
|
|
202
|
+
[self attachOverlayTouchHandler];
|
|
203
|
+
}
|
|
204
|
+
[self updateOverlayAccessibilityState];
|
|
205
|
+
} else {
|
|
206
|
+
if (_overlayContainer != nil) {
|
|
207
|
+
[self restoreInlinePresentation];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
- (void)attachOverlayTouchHandler
|
|
213
|
+
{
|
|
214
|
+
if (_overlayTouchHandler.view == _overlayContainer) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
[self detachOverlayTouchHandler];
|
|
218
|
+
[_overlayTouchHandler attachToView:_overlayContainer];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
- (void)detachOverlayTouchHandler
|
|
222
|
+
{
|
|
223
|
+
UIView *attachedView = _overlayTouchHandler.view;
|
|
224
|
+
if (attachedView != nil) {
|
|
225
|
+
[_overlayTouchHandler detachFromView:attachedView];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
- (void)updateOverlayAccessibilityState
|
|
230
|
+
{
|
|
231
|
+
_overlayContainer.accessibilityViewIsModal = _nativeOverlay && _sheetView.isModalAccessibilityActive;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/// Moves the sheet back under this component view and detaches the overlay
|
|
235
|
+
/// container. Safe to call when no overlay is active.
|
|
236
|
+
- (void)restoreInlinePresentation
|
|
237
|
+
{
|
|
238
|
+
if (_overlayContainer != nil) {
|
|
239
|
+
_overlayContainer.accessibilityViewIsModal = NO;
|
|
240
|
+
[self detachOverlayTouchHandler];
|
|
241
|
+
[_overlayContainer removeFromSuperview];
|
|
242
|
+
}
|
|
243
|
+
self.contentView = nil;
|
|
244
|
+
self.contentView = _sheetView;
|
|
245
|
+
_overlayContainer = nil;
|
|
246
|
+
}
|
|
247
|
+
|
|
105
248
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
106
249
|
{
|
|
107
250
|
// Identify the visual surface by component type so the host can own its
|
|
@@ -152,6 +295,7 @@ using namespace facebook::react;
|
|
|
152
295
|
|
|
153
296
|
float contentOffsetY = static_cast<float>(view.currentContentOffsetY);
|
|
154
297
|
if (contentOffsetY == _lastContentOffsetY) {
|
|
298
|
+
[self updateOverlayAccessibilityState];
|
|
155
299
|
return;
|
|
156
300
|
}
|
|
157
301
|
_lastContentOffsetY = contentOffsetY;
|
|
@@ -159,6 +303,7 @@ using namespace facebook::react;
|
|
|
159
303
|
if (_sheetState) {
|
|
160
304
|
updateBottomSheetContentOffsetY(_sheetState, contentOffsetY);
|
|
161
305
|
}
|
|
306
|
+
[self updateOverlayAccessibilityState];
|
|
162
307
|
}
|
|
163
308
|
|
|
164
309
|
- (void)bottomSheetView:(BottomSheetContentView *)view didReportError:(NSString *)message
|
|
@@ -169,6 +314,10 @@ using namespace facebook::react;
|
|
|
169
314
|
- (void)prepareForRecycle
|
|
170
315
|
{
|
|
171
316
|
[super prepareForRecycle];
|
|
317
|
+
// Restore inline parenting after the base class resets Fabric view state so a
|
|
318
|
+
// reused instance starts from the default presentation.
|
|
319
|
+
_nativeOverlay = NO;
|
|
320
|
+
[self restoreInlinePresentation];
|
|
172
321
|
_needsIndexSyncAfterRecycle = YES;
|
|
173
322
|
[_sheetView resetSheetState];
|
|
174
323
|
_sheetState.reset();
|
|
@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
20
20
|
@property (nonatomic) BOOL modal;
|
|
21
21
|
@property (nonatomic) BOOL disableScrollableNegotiation;
|
|
22
22
|
@property (nonatomic, readonly) UIView *sheetContainer;
|
|
23
|
+
@property (nonatomic, readonly) BOOL isModalAccessibilityActive;
|
|
23
24
|
|
|
24
25
|
- (void)setDetents:(NSArray<NSDictionary *> *)raw;
|
|
25
26
|
- (void)setMaxDetentHeight:(CGFloat)maxDetentHeight;
|
|
@@ -90,6 +90,11 @@
|
|
|
90
90
|
return _impl.currentContentOffsetY;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
- (BOOL)isModalAccessibilityActive
|
|
94
|
+
{
|
|
95
|
+
return _impl.isModalAccessibilityActive;
|
|
96
|
+
}
|
|
97
|
+
|
|
93
98
|
- (void)mountChildComponentView:(UIView *)childView atIndex:(NSInteger)index
|
|
94
99
|
{
|
|
95
100
|
[_impl mountChildComponentView:childView atIndex:index];
|
|
@@ -189,10 +189,18 @@ public final class BottomSheetHostingView: UIView {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
private var presentedSheetFrame: CGRect {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
guard activeSpring != nil else { return sheetContainer.frame }
|
|
193
|
+
// Mid-settle, derive the on-screen frame from the spring instead of the
|
|
194
|
+
// presentation layer (which lags one commit behind right after a snap
|
|
195
|
+
// starts). The container's transform is translation-only.
|
|
196
|
+
let size = sheetContainer.bounds.size
|
|
197
|
+
let center = sheetContainer.center
|
|
198
|
+
return CGRect(
|
|
199
|
+
x: center.x - size.width / 2,
|
|
200
|
+
y: center.y - size.height / 2 + currentTranslationY,
|
|
201
|
+
width: size.width,
|
|
202
|
+
height: size.height
|
|
203
|
+
)
|
|
196
204
|
}
|
|
197
205
|
|
|
198
206
|
override public func point(inside point: CGPoint, with _: UIEvent?) -> Bool {
|
|
@@ -350,6 +358,10 @@ public final class BottomSheetHostingView: UIView {
|
|
|
350
358
|
return containerTop + ty
|
|
351
359
|
}
|
|
352
360
|
|
|
361
|
+
public var isModalAccessibilityActive: Bool {
|
|
362
|
+
isScrimVisible
|
|
363
|
+
}
|
|
364
|
+
|
|
353
365
|
private var isScrimVisible: Bool {
|
|
354
366
|
modal && !scrimView.isHidden
|
|
355
367
|
}
|
|
@@ -514,7 +526,7 @@ public final class BottomSheetHostingView: UIView {
|
|
|
514
526
|
|
|
515
527
|
@discardableResult
|
|
516
528
|
private func cancelActiveSpring() -> CGFloat {
|
|
517
|
-
let visualTy =
|
|
529
|
+
let visualTy = currentTranslationY
|
|
518
530
|
activeSpring = nil
|
|
519
531
|
activeSpringEmitsSettle = false
|
|
520
532
|
stopDisplayLink()
|
|
@@ -910,11 +922,15 @@ extension BottomSheetHostingView: UIGestureRecognizerDelegate {
|
|
|
910
922
|
private extension BottomSheetHostingView {
|
|
911
923
|
var currentTranslationY: CGFloat {
|
|
912
924
|
// During a settle the modal is driven by a keyframe animation on the render
|
|
913
|
-
// server
|
|
914
|
-
//
|
|
915
|
-
//
|
|
916
|
-
|
|
917
|
-
|
|
925
|
+
// server (the model `transform` already holds the final target), so read the
|
|
926
|
+
// analytical spring the keyframes were sampled from. The presentation layer
|
|
927
|
+
// is deliberately not used: right after a snap starts it still holds the
|
|
928
|
+
// previously committed transform, and that stale value (e.g. the identity
|
|
929
|
+
// transform from before the first layout) reads as a wide-open sheet — which
|
|
930
|
+
// briefly flashed the scrim on mount. A drag assigns `transform` directly,
|
|
931
|
+
// so outside a settle the model value is correct.
|
|
932
|
+
if let spring = activeSpring {
|
|
933
|
+
return spring.value(at: CACurrentMediaTime())
|
|
918
934
|
}
|
|
919
935
|
return sheetContainer.transform.ty
|
|
920
936
|
}
|
|
@@ -936,6 +952,14 @@ private extension BottomSheetHostingView {
|
|
|
936
952
|
return
|
|
937
953
|
}
|
|
938
954
|
|
|
955
|
+
// Until the first layout places the sheet, the identity transform reads as
|
|
956
|
+
// a fully-open sheet; keep the scrim hidden until the sheet is positioned.
|
|
957
|
+
if !hasLaidOut {
|
|
958
|
+
scrimView.alpha = 0
|
|
959
|
+
scrimView.isHidden = true
|
|
960
|
+
return
|
|
961
|
+
}
|
|
962
|
+
|
|
939
963
|
// If we're settled on the closed detent, dynamic detent/content updates can
|
|
940
964
|
// momentarily report a stale non-zero position. Keep scrim fully hidden.
|
|
941
965
|
if
|
|
@@ -19,22 +19,24 @@ export { programmatic } from "./bottomSheetUtils.js";
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
/** Native bottom sheet that renders inline within the current screen layout. */
|
|
22
|
-
export const BottomSheet =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
export const BottomSheet = props => {
|
|
23
|
+
const {
|
|
24
|
+
children,
|
|
25
|
+
surface,
|
|
26
|
+
style,
|
|
27
|
+
detents = [0, 'content'],
|
|
28
|
+
index,
|
|
29
|
+
animateIn = true,
|
|
30
|
+
onIndexChange,
|
|
31
|
+
onSettle,
|
|
32
|
+
onPositionChange,
|
|
33
|
+
wrapNativeView,
|
|
34
|
+
modal = false,
|
|
35
|
+
nativeOverlay = false,
|
|
36
|
+
disableScrollableNegotiation = false,
|
|
37
|
+
scrimColor,
|
|
38
|
+
scrimOpacities
|
|
39
|
+
} = props;
|
|
38
40
|
const {
|
|
39
41
|
height: windowHeight
|
|
40
42
|
} = useSafeAreaFrame();
|
|
@@ -63,6 +65,7 @@ export const BottomSheet = ({
|
|
|
63
65
|
// fully opaque at every open one. Mapping each detent independently keeps
|
|
64
66
|
// this correct regardless of the order detents are passed in.
|
|
65
67
|
const resolvedScrimOpacity = scrimOpacities ?? detents.map(detent => resolveDetentValue(detent) === 0 ? 0 : 1);
|
|
68
|
+
const usesNativeOverlay = modal && nativeOverlay;
|
|
66
69
|
const handleIndexChange = event => {
|
|
67
70
|
onIndexChange?.(event.nativeEvent.index);
|
|
68
71
|
};
|
|
@@ -101,6 +104,7 @@ export const BottomSheet = ({
|
|
|
101
104
|
index: index,
|
|
102
105
|
animateIn: animateIn,
|
|
103
106
|
modal: modal,
|
|
107
|
+
nativeOverlay: usesNativeOverlay,
|
|
104
108
|
disableScrollableNegotiation: disableScrollableNegotiation,
|
|
105
109
|
scrimColor: scrimColor,
|
|
106
110
|
scrimOpacities: resolvedScrimOpacity,
|
|
@@ -127,6 +131,12 @@ export const BottomSheet = ({
|
|
|
127
131
|
})
|
|
128
132
|
});
|
|
129
133
|
if (modal) {
|
|
134
|
+
// In native-overlay mode the sheet is rendered inline; the native layer
|
|
135
|
+
// reparents it into a full-screen overlay above everything (including
|
|
136
|
+
// native modal screens), so it bypasses the provider portal entirely.
|
|
137
|
+
if (usesNativeOverlay) {
|
|
138
|
+
return sheet;
|
|
139
|
+
}
|
|
130
140
|
return /*#__PURE__*/_jsx(Portal, {
|
|
131
141
|
children: sheet
|
|
132
142
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","BottomSheetNativeView","BottomSheetSurfaceNativeComponent","Portal","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","children","surface","style","detents","index","animateIn","onIndexChange","onSettle","onPositionChange","wrapNativeView","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","NativeView","sheet","absoluteFill","pointerEvents","position","left","right","bottom","maxDetentHeight","collapsable","flex"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAA4C,OAAO;AAEpE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SACEC,gBAAgB,EAChBC,iBAAiB,QACZ,gCAAgC;AAEvC,OAAOC,qBAAqB,MAErB,8BAA8B;AACrC,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,SAASC,MAAM,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,SAASC,YAAY,QAAQ,uBAAoB;;AAEjD;AACA;AACA;AACA;;AAaA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["useState","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","BottomSheetNativeView","BottomSheetSurfaceNativeComponent","Portal","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","props","children","surface","style","detents","index","animateIn","onIndexChange","onSettle","onPositionChange","wrapNativeView","modal","nativeOverlay","disableScrollableNegotiation","scrimColor","scrimOpacities","height","windowHeight","insets","maxHeight","top","nativeDetents","map","detent","isDetentProgrammatic","value","resolveDetentValue","kind","Math","max","min","clampedIndex","length","selectedDetentValue","isCollapsed","resolvedScrimOpacity","usesNativeOverlay","handleIndexChange","event","nativeEvent","handleSettle","NativeView","sheet","absoluteFill","pointerEvents","position","left","right","bottom","maxDetentHeight","collapsable","flex"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAA4C,OAAO;AAEpE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SACEC,gBAAgB,EAChBC,iBAAiB,QACZ,gCAAgC;AAEvC,OAAOC,qBAAqB,MAErB,8BAA8B;AACrC,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,SAASC,MAAM,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,SAASC,YAAY,QAAQ,uBAAoB;;AAEjD;AACA;AACA;AACA;;AAaA;AACA;AACA;;AA8FA;AACA,OAAO,MAAMC,WAAW,GAAIC,KAAuB,IAAK;EACtD,MAAM;IACJC,QAAQ;IACRC,OAAO;IACPC,KAAK;IACLC,OAAO,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC;IACxBC,KAAK;IACLC,SAAS,GAAG,IAAI;IAChBC,aAAa;IACbC,QAAQ;IACRC,gBAAgB;IAChBC,cAAc;IACdC,KAAK,GAAG,KAAK;IACbC,aAAa,GAAG,KAAK;IACrBC,4BAA4B,GAAG,KAAK;IACpCC,UAAU;IACVC;EACF,CAAC,GAAGf,KAAiC;EACrC,MAAM;IAAEgB,MAAM,EAAEC;EAAa,CAAC,GAAG5B,gBAAgB,CAAC,CAAC;EACnD,MAAM6B,MAAM,GAAG5B,iBAAiB,CAAC,CAAC;EAClC,MAAM6B,SAAS,GAAGF,YAAY,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A,EAE9BC;QAAO,CACyB,CACpC,eACDL,KAAA,CAACT,IAAI;UAAC8D,WAAW,EAAE,KAAM;UAAC/C,KAAK,EAAE;YAAEgD,IAAI,EAAE,CAAC;YAAEhC;UAAU,CAAE;UAAAlB,QAAA,GACrDA,QAAQ,eACTN,IAAA,CAACP,IAAI;YAAC8D,WAAW,EAAE,KAAM;YAACN,aAAa,EAAC;UAAM,CAAE,CAAC;QAAA,CAC7C,CAAC;MAAA,CACG;IAAC,CACT;EAAC,CACH,CACP;EAED,IAAIjC,KAAK,EAAE;IACT;IACA;IACA;IACA,IAAIyB,iBAAiB,EAAE;MACrB,OAAOM,KAAK;IACd;IACA,oBAAO/C,IAAA,CAACF,MAAM;MAAAQ,QAAA,EAAEyC;IAAK,CAAS,CAAC;EACjC;EAEA,OAAOA,KAAK;AACd,CAAC;AAED,SAASlB,oBAAoBA,CAACD,MAAc,EAAW;EACrD,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjD,OAAOA,MAAM,CAACzB,YAAY,KAAK,IAAI;EACrC;EACA,OAAO,KAAK;AACd;AAEA,SAAS4B,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":[]}
|
|
@@ -17,6 +17,7 @@ export interface NativeProps extends ViewProps {
|
|
|
17
17
|
index: CodegenTypes.Int32;
|
|
18
18
|
animateIn?: CodegenTypes.WithDefault<boolean, true>;
|
|
19
19
|
modal: boolean;
|
|
20
|
+
nativeOverlay?: boolean;
|
|
20
21
|
disableScrollableNegotiation?: boolean;
|
|
21
22
|
scrimColor?: ColorValue;
|
|
22
23
|
scrimOpacities?: ReadonlyArray<CodegenTypes.Double>;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { createElement } from 'react';
|
|
3
4
|
import { BottomSheet } from "./BottomSheet.js";
|
|
4
5
|
|
|
5
6
|
/** Props for the modal bottom-sheet variant rendered through the provider portal. */
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
/** Bottom sheet presented above the current UI with a scrim. */
|
|
8
|
-
export const ModalBottomSheet = props =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export const ModalBottomSheet = props => {
|
|
10
|
+
// `modal` lives on the internal prop set (it is hidden from the public
|
|
11
|
+
// `BottomSheet` type), so type the merged object as the internal shape rather
|
|
12
|
+
// than casting it away.
|
|
13
|
+
const internalProps = {
|
|
14
|
+
...props,
|
|
15
|
+
modal: true
|
|
16
|
+
};
|
|
17
|
+
return /*#__PURE__*/createElement(BottomSheet, internalProps);
|
|
18
|
+
};
|
|
12
19
|
//# sourceMappingURL=ModalBottomSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createElement","BottomSheet","ModalBottomSheet","props","internalProps","modal"],"sourceRoot":"../../src","sources":["ModalBottomSheet.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,OAAO;AAErC,SACEC,WAAW,QAGN,kBAAe;;AAEtB;;AAsCA;AACA,OAAO,MAAMC,gBAAgB,GAAIC,KAA4B,IAAK;EAChE;EACA;EACA;EACA,MAAMC,aAAuC,GAAG;IAAE,GAAGD,KAAK;IAAEE,KAAK,EAAE;EAAK,CAAC;EACzE,oBAAOL,aAAa,CAACC,WAAW,EAAEG,aAAa,CAAC;AAClD,CAAC","ignoreList":[]}
|
|
@@ -73,19 +73,27 @@ export interface BottomSheetProps {
|
|
|
73
73
|
* render).
|
|
74
74
|
*/
|
|
75
75
|
wrapNativeView?: (component: ComponentType<NativeProps>) => ComponentType<NativeProps>;
|
|
76
|
-
/** Internal flag used by `ModalBottomSheet`. */
|
|
77
|
-
modal?: boolean;
|
|
78
76
|
/**
|
|
79
77
|
* Escape hatch that disables sheet/list gesture negotiation.
|
|
80
78
|
* If a gesture starts inside a nested scrollable, that scrollable keeps it
|
|
81
79
|
* even when it cannot scroll any further.
|
|
82
80
|
*/
|
|
83
81
|
disableScrollableNegotiation?: boolean;
|
|
82
|
+
}
|
|
83
|
+
type ModalOnlyBottomSheetProps = {
|
|
84
|
+
/** Internal flag used by `ModalBottomSheet`. */
|
|
85
|
+
modal?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Internal flag used by `ModalBottomSheet`. When set, the sheet is presented
|
|
88
|
+
* in a native overlay above everything (including native modal screens)
|
|
89
|
+
* instead of the `BottomSheetProvider` portal.
|
|
90
|
+
*/
|
|
91
|
+
nativeOverlay?: boolean;
|
|
84
92
|
/** Scrim color used by `ModalBottomSheet`. */
|
|
85
93
|
scrimColor?: string;
|
|
86
94
|
/**
|
|
87
|
-
* Scrim opacities per detent, indexed to match `detents`. Each value in 0
|
|
88
|
-
* scales the scrim color
|
|
95
|
+
* Scrim opacities per detent, indexed to match `detents`. Each value in 0-1
|
|
96
|
+
* scales the scrim color's alpha at the detent of the same index, and the
|
|
89
97
|
* opacity is linearly interpolated as the sheet is dragged between detents.
|
|
90
98
|
* A shorter array than `detents` reuses its last value for any remaining
|
|
91
99
|
* detents.
|
|
@@ -93,11 +101,12 @@ export interface BottomSheetProps {
|
|
|
93
101
|
* The default maps each detent to 0 when it is closed and 1 otherwise,
|
|
94
102
|
* so the scrim is transparent at any closed detent and fully opaque at every
|
|
95
103
|
* open one; e.g., `[0, 'content']` defaults to `[0, 1]`, and all-open detents
|
|
96
|
-
* default to a constant opaque scrim. Pass one value per detent
|
|
97
|
-
* `[0, 0.5, 1]
|
|
104
|
+
* default to a constant opaque scrim. Pass one value per detent, e.g.
|
|
105
|
+
* `[0, 0.5, 1]`, to keep the scrim deepening across every detent.
|
|
98
106
|
*/
|
|
99
107
|
scrimOpacities?: number[];
|
|
100
|
-
}
|
|
108
|
+
};
|
|
109
|
+
export type BottomSheetInternalProps = BottomSheetProps & ModalOnlyBottomSheetProps;
|
|
101
110
|
/** Native bottom sheet that renders inline within the current screen layout. */
|
|
102
|
-
export declare const BottomSheet: (
|
|
111
|
+
export declare const BottomSheet: (props: BottomSheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
103
112
|
//# sourceMappingURL=BottomSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAO/E,OAA8B,EAC5B,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAGtC,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;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,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,EAA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|
12
12
|
modal: boolean;
|
|
13
|
+
nativeOverlay?: boolean;
|
|
13
14
|
disableScrollableNegotiation?: boolean;
|
|
14
15
|
scrimColor?: ColorValue;
|
|
15
16
|
scrimOpacities?: ReadonlyArray<CodegenTypes.Double>;
|
|
@@ -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,cAAc,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACpD,aAAa,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAC7C,QAAQ,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;KAAE,CAAC,CACxC,CAAC;IACF,QAAQ,CAAC,EAAE,YAAY,CAAC,kBAAkB,CACxC,QAAQ,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;KAAE,CAAC,CACxC,CAAC;IACF,gBAAgB,CAAC,E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xC,CAAC;IACF,gBAAgB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAChD,QAAQ,CAAC;QAAE,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAA;KAAE,CAAC,CACxE,CAAC;CACH;;AAED,wBAAsE"}
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
import { type BottomSheetProps } from './BottomSheet';
|
|
2
2
|
/** Props for the modal bottom-sheet variant rendered through the provider portal. */
|
|
3
|
-
export interface ModalBottomSheetProps extends
|
|
3
|
+
export interface ModalBottomSheetProps extends BottomSheetProps {
|
|
4
|
+
/**
|
|
5
|
+
* Present the sheet in a native overlay above everything—including native
|
|
6
|
+
* modal screens (e.g. a React Navigation native-stack `presentation: "modal"`)
|
|
7
|
+
* —instead of the `BottomSheetProvider` portal.
|
|
8
|
+
*
|
|
9
|
+
* The portal renders into the provider's React tree, so a sheet opened from
|
|
10
|
+
* within a native modal screen is trapped inside that screen and cannot cover
|
|
11
|
+
* the full window. With `nativeOverlay`, the sheet is reparented natively into
|
|
12
|
+
* a window-level overlay (a `UIWindow`-attached container on iOS, a
|
|
13
|
+
* full-screen transparent dialog on Android) that floats above the modal.
|
|
14
|
+
*
|
|
15
|
+
* No `BottomSheetProvider` is required in this mode. The sheet sizes relative
|
|
16
|
+
* to its nearest full-size ancestor, so render it at the top level of a screen
|
|
17
|
+
* as you normally would.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
nativeOverlay?: boolean;
|
|
22
|
+
/** Scrim color shown behind the modal sheet. */
|
|
23
|
+
scrimColor?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Scrim opacities per detent, indexed to match `detents`. Each value in 0-1
|
|
26
|
+
* scales the scrim color's alpha at the detent of the same index, and the
|
|
27
|
+
* opacity is linearly interpolated as the sheet is dragged between detents.
|
|
28
|
+
* A shorter array than `detents` reuses its last value for any remaining
|
|
29
|
+
* detents.
|
|
30
|
+
*
|
|
31
|
+
* The default maps each detent to 0 when it is closed and 1 otherwise,
|
|
32
|
+
* so the scrim is transparent at any closed detent and fully opaque at every
|
|
33
|
+
* open one; e.g., `[0, 'content']` defaults to `[0, 1]`, and all-open detents
|
|
34
|
+
* default to a constant opaque scrim. Pass one value per detent, e.g.
|
|
35
|
+
* `[0, 0.5, 1]`, to keep the scrim deepening across every detent.
|
|
36
|
+
*/
|
|
37
|
+
scrimOpacities?: number[];
|
|
4
38
|
}
|
|
5
39
|
/** Bottom sheet presented above the current UI with a scrim. */
|
|
6
|
-
export declare const ModalBottomSheet: (props: ModalBottomSheetProps) => import("react
|
|
40
|
+
export declare const ModalBottomSheet: (props: ModalBottomSheetProps) => import("react").FunctionComponentElement<BottomSheetProps>;
|
|
7
41
|
//# sourceMappingURL=ModalBottomSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalBottomSheet.d.ts","sourceRoot":"","sources":["../../../src/ModalBottomSheet.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModalBottomSheet.d.ts","sourceRoot":"","sources":["../../../src/ModalBottomSheet.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,qFAAqF;AACrF,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,+DAM5D,CAAC"}
|
package/package.json
CHANGED