@onekeyfe/react-native-native-overlay 6.7.0-alpha.384 → 6.7.0-alpha.386
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/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayViewManager.kt +3 -0
- package/docs/SPEC.md +105 -0
- package/ios/NativeOverlayContainerView.swift +15 -0
- package/ios/RCTNativeOverlayComponentView.mm +24 -0
- package/lib/module/NativeOverlayNativeComponent.ts +14 -0
- package/lib/module/OverlayView.js +123 -8
- package/lib/module/OverlayView.js.map +1 -1
- package/lib/module/OverlayView.web.js +5 -0
- package/lib/module/OverlayView.web.js.map +1 -1
- package/lib/module/sheetWidth.js +21 -0
- package/lib/module/sheetWidth.js.map +1 -0
- package/lib/typescript/src/NativeOverlayNativeComponent.d.ts +12 -0
- package/lib/typescript/src/NativeOverlayNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/OverlayView.d.ts.map +1 -1
- package/lib/typescript/src/OverlayView.web.d.ts.map +1 -1
- package/lib/typescript/src/OverlayViewTypes.d.ts +17 -0
- package/lib/typescript/src/OverlayViewTypes.d.ts.map +1 -1
- package/lib/typescript/src/sheetWidth.d.ts +15 -0
- package/lib/typescript/src/sheetWidth.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/NativeOverlayNativeComponent.ts +14 -0
- package/src/OverlayView.tsx +130 -7
- package/src/OverlayView.web.tsx +5 -0
- package/src/OverlayViewTypes.ts +14 -0
- package/src/sheetWidth.ts +25 -0
|
@@ -130,6 +130,9 @@ class NativeOverlayViewManager :
|
|
|
130
130
|
view.sheetHeight = value
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
// Android measures in screen space already; it never reports an offset.
|
|
134
|
+
override fun setHostOriginRequest(view: NativeOverlayView, value: Int) = Unit
|
|
135
|
+
|
|
133
136
|
override fun setSheetCornerRadius(view: NativeOverlayView, value: Double) {
|
|
134
137
|
view.sheetCornerRadius = value
|
|
135
138
|
}
|
package/docs/SPEC.md
CHANGED
|
@@ -323,6 +323,108 @@ retain their configured surface color on Mac Catalyst and MUST NOT call
|
|
|
323
323
|
which are unavailable there. iOS 26.1 and later retain their existing color
|
|
324
324
|
effect. Presentation, sizing, motion, and lifecycle contracts are unchanged.
|
|
325
325
|
|
|
326
|
+
### Sheet content width
|
|
327
|
+
|
|
328
|
+
Implemented; unit-tested and iOS native build verified. The reported-width
|
|
329
|
+
path is not yet runtime-verified on a wide window (the app's Dialog and
|
|
330
|
+
ActionList no longer present sheets there). Android and Web unchanged.
|
|
331
|
+
UIKit sizes a global sheet itself and
|
|
332
|
+
gives it less than the window width on wide windows (centered, about 650 pt
|
|
333
|
+
in iPhone compact-height landscape), and `preferredContentSize` with
|
|
334
|
+
`widthFollowsPreferredContentSizeWhenEdgeAttached` was measured not to
|
|
335
|
+
control that width or its position reliably. So the overlay never forces a
|
|
336
|
+
sheet width; the content follows the sheet instead:
|
|
337
|
+
|
|
338
|
+
- iOS emits `onSheetLayout { width }` whenever the sheet's width settles or
|
|
339
|
+
changes (presentation, rotation, window resize), for both UIKit global
|
|
340
|
+
sheets and page-scope sheets, including while the sheet is still entering.
|
|
341
|
+
It is deduplicated to changes of at least 0.5 pt.
|
|
342
|
+
- JS lays the content out at `min(reported width ?? window width, window
|
|
343
|
+
width)`. Before the first report the content uses the window width, as
|
|
344
|
+
before; a narrower report re-lays it out and the fitted height follows.
|
|
345
|
+
- `sheet.maxWidth` caps the content width; any remaining sheet width is split
|
|
346
|
+
evenly as horizontal inset, so the content is centered in a wider sheet.
|
|
347
|
+
- Android never reports; its sheets stay full width and the content fills the
|
|
348
|
+
window width (or `maxWidth`, centered). Web is unchanged.
|
|
349
|
+
|
|
350
|
+
### Adaptive presentation by window width
|
|
351
|
+
|
|
352
|
+
Implemented: `sheet.maxWidth` in this package and one width resolver in the
|
|
353
|
+
App (`useOverlayWidthClass`). iOS runtime verification is in progress. The
|
|
354
|
+
overlay is the single owner of the rule below;
|
|
355
|
+
consumers (the App's Dialog, Popover, ActionList, Select and sheets) must
|
|
356
|
+
resolve their presentation through it instead of platform checks
|
|
357
|
+
(`isNativeIOSPad`, device type, Tamagui media clamped to the phone's short
|
|
358
|
+
side). The rule depends only on the current window width W, in points on
|
|
359
|
+
iOS, dp on Android and CSS px on Web, and is the same on every platform.
|
|
360
|
+
|
|
361
|
+
Width classes reuse the App's existing breakpoints:
|
|
362
|
+
|
|
363
|
+
| Class | Window width | Examples |
|
|
364
|
+
|---|---|---|
|
|
365
|
+
| compact | W < 640 | phones in portrait, iPhone Duo outer display in portrait (466), iPad Slide Over and narrow split windows, narrow browser windows |
|
|
366
|
+
| medium | 640 <= W < 768 | iPhone Duo inner display in portrait (669), iPhone Duo outer display in landscape (678), unfolded Android foldables in portrait |
|
|
367
|
+
| expanded | W >= 768 | iPhone Duo inner display in landscape (951), iPad full screen and large windows (834 and up), desktop, wide browser windows |
|
|
368
|
+
|
|
369
|
+
Presentation per overlay kind:
|
|
370
|
+
|
|
371
|
+
| Kind | compact | medium | expanded |
|
|
372
|
+
|---|---|---|---|
|
|
373
|
+
| Dialog (alerts, confirmations, short forms) | full-width sheet | max-width sheet | centered card, 400 wide, outline and no drop shadow |
|
|
374
|
+
| Anchorable menu: Select, ActionList or Popover with a trigger, or with a window rect (`ActionList.show`) | full-width sheet | max-width sheet | anchored panel next to the trigger or rect |
|
|
375
|
+
| Menu without an anchor (`ActionList.show` without a rect) | full-width sheet | max-width sheet | max-width sheet |
|
|
376
|
+
| Other sheets (pickers, long content, forms) | full-width sheet | max-width sheet | max-width sheet |
|
|
377
|
+
|
|
378
|
+
Max-width sheet (`sheet.maxWidth`, default 540):
|
|
379
|
+
|
|
380
|
+
- The visible surface is `min(sheet width, maxWidth)` wide, horizontally
|
|
381
|
+
centered, bottom-attached, with top corners only. JS draws the surface; on
|
|
382
|
+
iOS the UIKit sheet itself keeps whatever width UIKit gives it but renders
|
|
383
|
+
transparent (no background color, background effect or shadow), so the
|
|
384
|
+
surface looks the same however wide UIKit makes the sheet.
|
|
385
|
+
- The side margins behave as backdrop for taps: a tap there follows
|
|
386
|
+
`dismissOnBackdropPress`, and the margins are hidden from accessibility.
|
|
387
|
+
Known divergence: on iOS and Android the platform sheet owns the drag, so a
|
|
388
|
+
pan that starts on a margin still moves the sheet. On Web the margins are
|
|
389
|
+
the real backdrop.
|
|
390
|
+
- Setting `maxWidth` always switches to the drawn surface, even while it
|
|
391
|
+
spans the whole sheet, so a width change never swaps which side paints the
|
|
392
|
+
background.
|
|
393
|
+
- In compact windows the sheet is never wider than `maxWidth`, so the
|
|
394
|
+
max-width sheet and the full-width sheet are identical there.
|
|
395
|
+
|
|
396
|
+
Width changes while open (rotation, folding, window resize):
|
|
397
|
+
|
|
398
|
+
| Change | Anchored panel | Sheet | Centered card |
|
|
399
|
+
|---|---|---|---|
|
|
400
|
+
| Within one class | repositions to its anchor | surface width follows | stays centered |
|
|
401
|
+
| Across classes | closes | surface width follows | switches presentation in place, keeping content and input |
|
|
402
|
+
|
|
403
|
+
Open questions: whether the anchored panel should reopen as a sheet instead
|
|
404
|
+
of closing when the class drops below expanded.
|
|
405
|
+
|
|
406
|
+
### Window offset for modal-relative anchors
|
|
407
|
+
|
|
408
|
+
Implemented; iOS runtime-verified on an iPhone Duo inner display. Under
|
|
409
|
+
Fabric, `measureInWindow` / `measure` inside a react-native-screens native
|
|
410
|
+
modal return coordinates relative to that modal, not the screen (measured
|
|
411
|
+
offset of 150, 8 pt for the account selector page sheet in landscape), and no
|
|
412
|
+
JS API exposes the modal's position. Anchored overlays draw in screen
|
|
413
|
+
coordinates, so callers that anchor to a JS-measured rect ask the overlay for
|
|
414
|
+
the correction:
|
|
415
|
+
|
|
416
|
+
- `windowOffsetRequest` (a counter) and `onWindowOffset({ x, y })`. Each new
|
|
417
|
+
non-zero value makes iOS report the host's on-screen origin once, after the
|
|
418
|
+
commit settles; JS measures a plain sibling probe at the same spot and
|
|
419
|
+
reports `native - measured`. It is `{0, 0}` outside modals.
|
|
420
|
+
- The host's own shadow node reports the content origin, so the probe is a
|
|
421
|
+
separate view.
|
|
422
|
+
- The overlay must be mounted to report, so callers keep it mounted
|
|
423
|
+
(hidden) while waiting. Android never reports; callers treat a missing
|
|
424
|
+
report as no offset only where the platform cannot report.
|
|
425
|
+
- Rects already in screen space (for example from native lists) need no
|
|
426
|
+
correction.
|
|
427
|
+
|
|
326
428
|
### Web keyboard focus containment
|
|
327
429
|
|
|
328
430
|
The topmost active, unsuspended blocking Web entry MUST contain sequential
|
|
@@ -529,6 +631,9 @@ P2 sheet notes:
|
|
|
529
631
|
the next dismissal follows the normal exit path and restores focus.
|
|
530
632
|
Cancelling a tracked pointer resets its drag offset, transition and backdrop
|
|
531
633
|
without dismissing the sheet or swallowing a later click.
|
|
634
|
+
- Sheet content width follows the native `onSheetLayout` report and
|
|
635
|
+
`sheet.maxWidth` (see Sheet content width); `resolveSheetWidth` is unit
|
|
636
|
+
tested in `__tests__/sheetWidth.test.ts`.
|
|
532
637
|
- A fitted sheet measures its content with `onLayout` before presenting.
|
|
533
638
|
Hidden content stays mounted inside the zero-width host (clipped on iOS,
|
|
534
639
|
INVISIBLE on Android), and the host height stays auto: a fixed 0 height
|
|
@@ -232,6 +232,10 @@ final class NativeOverlayEntryView: UIView {
|
|
|
232
232
|
/// Window origin (points) of the view the content lives in; the shadow
|
|
233
233
|
/// node offsets `measure` / `measureInWindow` by it.
|
|
234
234
|
@objc public var onContentOffsetChanged: ((CGPoint) -> Void)?
|
|
235
|
+
/// Sheet presentation: the width UIKit (or the page host) gave the sheet,
|
|
236
|
+
/// so JS lays the content out at it instead of the window width.
|
|
237
|
+
@objc public var onSheetLayout: ((CGFloat) -> Void)?
|
|
238
|
+
private var reportedSheetWidth: CGFloat?
|
|
235
239
|
private var reportedContentOffset: CGPoint?
|
|
236
240
|
|
|
237
241
|
private enum Phase {
|
|
@@ -500,7 +504,18 @@ final class NativeOverlayEntryView: UIView {
|
|
|
500
504
|
/// level window, sheet, page host, or this host while staged). Only at
|
|
501
505
|
/// rest: the enter / exit transforms would skew it, while UIKit's own
|
|
502
506
|
/// sheet container transform must be included.
|
|
507
|
+
private func reportSheetWidth() {
|
|
508
|
+
guard isSheet, let container = contentChild?.superview else { return }
|
|
509
|
+
let width = container.bounds.width
|
|
510
|
+
guard width > 0 else { return }
|
|
511
|
+
if let reported = reportedSheetWidth, abs(reported - width) < 0.5 { return }
|
|
512
|
+
reportedSheetWidth = width
|
|
513
|
+
onSheetLayout?(width)
|
|
514
|
+
}
|
|
515
|
+
|
|
503
516
|
func reportContentOffset() {
|
|
517
|
+
// The sheet's width settles while it is still entering.
|
|
518
|
+
reportSheetWidth()
|
|
504
519
|
guard phase == .shown || phase == .hidden,
|
|
505
520
|
let container = contentChild?.superview,
|
|
506
521
|
let containerWindow = container.window
|
|
@@ -63,6 +63,7 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
63
63
|
RCTSurfaceTouchHandler *_touchHandler;
|
|
64
64
|
RNCNativeOverlayShadowNode::ConcreteState::Shared _state;
|
|
65
65
|
CGPoint _contentOffset;
|
|
66
|
+
int32_t _hostOriginRequest;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
@@ -104,6 +105,13 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
104
105
|
NSString *reason = body[@"reason"] ?: @"system";
|
|
105
106
|
emitter->onDismissed({.reason = std::string(reason.UTF8String)});
|
|
106
107
|
};
|
|
108
|
+
_containerView.onSheetLayout = ^(CGFloat width) {
|
|
109
|
+
auto strongSelf = weakSelf;
|
|
110
|
+
if (!strongSelf) return;
|
|
111
|
+
auto emitter = std::static_pointer_cast<const RNCNativeOverlayEventEmitter>(strongSelf->_eventEmitter);
|
|
112
|
+
if (!emitter) return;
|
|
113
|
+
emitter->onSheetLayout({.width = width});
|
|
114
|
+
};
|
|
107
115
|
_containerView.onRequestDismiss = ^(NSDictionary *body) {
|
|
108
116
|
auto strongSelf = weakSelf;
|
|
109
117
|
if (!strongSelf) return;
|
|
@@ -157,6 +165,22 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
157
165
|
_containerView.visible = newProps.visible;
|
|
158
166
|
[_containerView commitConfiguration];
|
|
159
167
|
|
|
168
|
+
if (newProps.hostOriginRequest != 0 && newProps.hostOriginRequest != _hostOriginRequest) {
|
|
169
|
+
_hostOriginRequest = newProps.hostOriginRequest;
|
|
170
|
+
// After the commit settles, report where this host really is on screen.
|
|
171
|
+
__weak auto weakSelf = self;
|
|
172
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
173
|
+
auto strongSelf = weakSelf;
|
|
174
|
+
if (!strongSelf || !strongSelf.window) return;
|
|
175
|
+
CGPoint origin = [strongSelf convertPoint:CGPointZero toView:nil];
|
|
176
|
+
origin.x += strongSelf.window.frame.origin.x;
|
|
177
|
+
origin.y += strongSelf.window.frame.origin.y;
|
|
178
|
+
auto emitter = std::static_pointer_cast<const RNCNativeOverlayEventEmitter>(strongSelf->_eventEmitter);
|
|
179
|
+
if (!emitter) return;
|
|
180
|
+
emitter->onHostWindowOrigin({.x = origin.x, .y = origin.y});
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
160
184
|
[super updateProps:props oldProps:oldProps];
|
|
161
185
|
}
|
|
162
186
|
|
|
@@ -14,6 +14,15 @@ type INativeOverlayRequestDismissEvent = Readonly<{
|
|
|
14
14
|
reason: string;
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
|
+
type INativeOverlayHostWindowOriginEvent = Readonly<{
|
|
18
|
+
x: CodegenTypes.Double;
|
|
19
|
+
y: CodegenTypes.Double;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
type INativeOverlaySheetLayoutEvent = Readonly<{
|
|
23
|
+
width: CodegenTypes.Double;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
17
26
|
type INativeOverlayPresentedEvent = Readonly<{
|
|
18
27
|
stackOrder: CodegenTypes.Int32;
|
|
19
28
|
}>;
|
|
@@ -51,6 +60,11 @@ export interface INativeOverlayNativeProps extends ViewProps {
|
|
|
51
60
|
onPresented?: CodegenTypes.DirectEventHandler<INativeOverlayPresentedEvent>;
|
|
52
61
|
onDismissed?: CodegenTypes.DirectEventHandler<INativeOverlayDismissedEvent>;
|
|
53
62
|
onRequestDismiss?: CodegenTypes.DirectEventHandler<INativeOverlayRequestDismissEvent>;
|
|
63
|
+
/** `sheet` presentation: the width the platform gave the sheet. */
|
|
64
|
+
onSheetLayout?: CodegenTypes.DirectEventHandler<INativeOverlaySheetLayoutEvent>;
|
|
65
|
+
/** Bump to have native report this host's on-screen origin once. */
|
|
66
|
+
hostOriginRequest?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
67
|
+
onHostWindowOrigin?: CodegenTypes.DirectEventHandler<INativeOverlayHostWindowOriginEvent>;
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
// The shadow node is hand-written (common/cpp): it carries the on-screen
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
4
|
-
import { StatusBar, StyleSheet, View, useWindowDimensions } from 'react-native';
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Pressable, StatusBar, StyleSheet, View, useWindowDimensions } from 'react-native';
|
|
5
5
|
import NativeOverlay from './NativeOverlayNativeComponent';
|
|
6
6
|
import { OverlayLevelProvider } from "./OverlayLevelContext.js";
|
|
7
7
|
import { isBlockingLevel } from "./OverlayLevels.js";
|
|
8
|
+
import { resolveSheetWidth } from "./sheetWidth.js";
|
|
8
9
|
import { useOverlayController } from "./useOverlayController.js";
|
|
9
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
const DEFAULT_BACKDROP_COLOR = 'rgba(0, 0, 0, 0.4)';
|
|
11
12
|
const DEFAULT_SHEET_MAX_RATIO = 0.92;
|
|
13
|
+
const DEFAULT_SHEET_CORNER_RADIUS = 24;
|
|
14
|
+
// Taller than any bottom safe area; the sheet clips the rest.
|
|
15
|
+
const SHEET_SURFACE_TAIL_HEIGHT = 120;
|
|
12
16
|
const REQUEST_REASONS = {
|
|
13
17
|
back: 'back',
|
|
14
18
|
backdrop: 'backdrop',
|
|
@@ -24,6 +28,30 @@ const styles = StyleSheet.create({
|
|
|
24
28
|
top: 0,
|
|
25
29
|
left: 0,
|
|
26
30
|
width: 0
|
|
31
|
+
},
|
|
32
|
+
sheetMarginLeft: {
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
top: 0,
|
|
35
|
+
bottom: 0,
|
|
36
|
+
left: 0
|
|
37
|
+
},
|
|
38
|
+
sheetMarginRight: {
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
top: 0,
|
|
41
|
+
bottom: 0,
|
|
42
|
+
right: 0
|
|
43
|
+
},
|
|
44
|
+
sheetSurface: {
|
|
45
|
+
borderCurve: 'continuous',
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
flexGrow: 1
|
|
48
|
+
},
|
|
49
|
+
// The platform sheet extends below the content (home indicator area); the
|
|
50
|
+
// drawn surface continues into it so no backdrop shows under the content.
|
|
51
|
+
sheetSurfaceTail: {
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
top: '100%',
|
|
54
|
+
height: SHEET_SURFACE_TAIL_HEIGHT
|
|
27
55
|
}
|
|
28
56
|
});
|
|
29
57
|
export function OverlayView(props) {
|
|
@@ -37,8 +65,26 @@ export function OverlayView(props) {
|
|
|
37
65
|
keepContentMounted = false,
|
|
38
66
|
statusBarStyle,
|
|
39
67
|
children,
|
|
40
|
-
testID
|
|
68
|
+
testID,
|
|
69
|
+
windowOffsetRequest,
|
|
70
|
+
onWindowOffset
|
|
41
71
|
} = props;
|
|
72
|
+
// A plain sibling at the host's spot: its JS-measured origin shares the
|
|
73
|
+
// modal-relative space of the caller's measurements, while native reports
|
|
74
|
+
// the true one (the host's own shadow node reports the content origin).
|
|
75
|
+
const offsetProbeRef = useRef(null);
|
|
76
|
+
const onHostWindowOrigin = useCallback(event => {
|
|
77
|
+
const {
|
|
78
|
+
x: nativeX,
|
|
79
|
+
y: nativeY
|
|
80
|
+
} = event.nativeEvent;
|
|
81
|
+
offsetProbeRef.current?.measureInWindow((x, y) => {
|
|
82
|
+
onWindowOffset?.({
|
|
83
|
+
x: nativeX - x,
|
|
84
|
+
y: nativeY - y
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}, [onWindowOffset]);
|
|
42
88
|
const isSheet = presentation === 'sheet';
|
|
43
89
|
const controller = useOverlayController(props);
|
|
44
90
|
const {
|
|
@@ -59,6 +105,29 @@ export function OverlayView(props) {
|
|
|
59
105
|
onHostRequestDismiss
|
|
60
106
|
} = controller;
|
|
61
107
|
const [measuredSheetHeight, setMeasuredSheetHeight] = useState(0);
|
|
108
|
+
// iOS sizes a sheet itself (narrower than the window on wide windows), so
|
|
109
|
+
// the content follows the width native reports; Android sheets span the
|
|
110
|
+
// window and never report.
|
|
111
|
+
const [reportedSheetWidth, setReportedSheetWidth] = useState();
|
|
112
|
+
const {
|
|
113
|
+
containerWidth: sheetContainerWidth,
|
|
114
|
+
inset: sheetInset
|
|
115
|
+
} = resolveSheetWidth({
|
|
116
|
+
windowWidth: width,
|
|
117
|
+
reportedWidth: reportedSheetWidth,
|
|
118
|
+
maxWidth: sheet?.maxWidth
|
|
119
|
+
});
|
|
120
|
+
// `maxWidth` turns on the drawn surface even while it spans the whole sheet,
|
|
121
|
+
// so a width change never swaps who paints the background.
|
|
122
|
+
const hasSheetSurface = isSheet && sheet?.maxWidth !== undefined;
|
|
123
|
+
const dismissOnBackdropPress = backdrop ? !!backdrop.dismissOnPress : false;
|
|
124
|
+
const onSheetMarginPress = useCallback(() => {
|
|
125
|
+
// The margins beside a max-width surface stand in for the backdrop.
|
|
126
|
+
if (dismissOnBackdropPress) onHostRequestDismiss('backdrop');
|
|
127
|
+
}, [dismissOnBackdropPress, onHostRequestDismiss]);
|
|
128
|
+
const onSheetLayoutReport = useCallback(event => {
|
|
129
|
+
setReportedSheetWidth(event.nativeEvent.width);
|
|
130
|
+
}, []);
|
|
62
131
|
const maxSheetHeight = sheet?.maxHeight ?? height * DEFAULT_SHEET_MAX_RATIO;
|
|
63
132
|
const sheetHeight = Math.min(sheet?.height ?? measuredSheetHeight, maxSheetHeight);
|
|
64
133
|
const onSheetLayout = useCallback(event => {
|
|
@@ -82,7 +151,12 @@ export function OverlayView(props) {
|
|
|
82
151
|
barStyle: statusBarStyle === 'light' ? 'light-content' : 'dark-content'
|
|
83
152
|
}) : null;
|
|
84
153
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
85
|
-
children: [statusBar, /*#__PURE__*/_jsx(
|
|
154
|
+
children: [statusBar, onWindowOffset ? /*#__PURE__*/_jsx(View, {
|
|
155
|
+
ref: offsetProbeRef,
|
|
156
|
+
collapsable: false,
|
|
157
|
+
pointerEvents: "none",
|
|
158
|
+
style: styles.host
|
|
159
|
+
}) : null, /*#__PURE__*/_jsx(NativeOverlay, {
|
|
86
160
|
style: styles.host
|
|
87
161
|
// A fitted sheet presents once its content height is known.
|
|
88
162
|
,
|
|
@@ -99,26 +173,67 @@ export function OverlayView(props) {
|
|
|
99
173
|
backdropColor: backdrop ? backdrop.color ?? DEFAULT_BACKDROP_COLOR : undefined,
|
|
100
174
|
sheetHeight: isSheet ? sheetHeight : 0,
|
|
101
175
|
sheetCornerRadius: sheet?.cornerRadius,
|
|
102
|
-
showHandle: sheet?.showHandle
|
|
103
|
-
|
|
176
|
+
showHandle: sheet?.showHandle
|
|
177
|
+
// A max-width sheet draws its own surface, so the platform sheet
|
|
178
|
+
// stays transparent beside it.
|
|
179
|
+
,
|
|
180
|
+
sheetBackgroundColor: hasSheetSurface ? 'transparent' : sheet?.backgroundColor,
|
|
104
181
|
dismissOnPanDown: sheet?.dismissOnPanDown ?? true,
|
|
105
182
|
animationConfig: animationConfig,
|
|
106
183
|
onPresented: onHostPresented,
|
|
107
184
|
onDismissed: onDismissed,
|
|
108
185
|
onRequestDismiss: onRequestDismiss,
|
|
186
|
+
onSheetLayout: isSheet ? onSheetLayoutReport : undefined,
|
|
187
|
+
hostOriginRequest: onWindowOffset ? windowOffsetRequest ?? 0 : 0,
|
|
188
|
+
onHostWindowOrigin: onWindowOffset ? onHostWindowOrigin : undefined,
|
|
109
189
|
testID: testID,
|
|
110
190
|
children: isSheet ? /*#__PURE__*/_jsx(View, {
|
|
111
191
|
collapsable: false,
|
|
112
192
|
onLayout: onSheetLayout,
|
|
113
193
|
style: {
|
|
114
|
-
width,
|
|
194
|
+
width: sheetContainerWidth,
|
|
195
|
+
paddingHorizontal: sheetInset,
|
|
115
196
|
height: sheet?.height,
|
|
116
197
|
maxHeight: maxSheetHeight,
|
|
117
198
|
// The host is 0x0; without this Yoga shrinks the content to 0 and
|
|
118
199
|
// a fitted sheet never learns its height.
|
|
119
200
|
flexShrink: 0
|
|
120
201
|
},
|
|
121
|
-
children: /*#__PURE__*/
|
|
202
|
+
children: hasSheetSurface ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
203
|
+
children: [sheetInset > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
204
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
205
|
+
accessible: false,
|
|
206
|
+
importantForAccessibility: "no-hide-descendants",
|
|
207
|
+
onPress: onSheetMarginPress,
|
|
208
|
+
style: [styles.sheetMarginLeft, {
|
|
209
|
+
width: sheetInset
|
|
210
|
+
}]
|
|
211
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
212
|
+
accessible: false,
|
|
213
|
+
importantForAccessibility: "no-hide-descendants",
|
|
214
|
+
onPress: onSheetMarginPress,
|
|
215
|
+
style: [styles.sheetMarginRight, {
|
|
216
|
+
width: sheetInset
|
|
217
|
+
}]
|
|
218
|
+
})]
|
|
219
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
220
|
+
style: [styles.sheetSurfaceTail, {
|
|
221
|
+
left: sheetInset,
|
|
222
|
+
right: sheetInset,
|
|
223
|
+
backgroundColor: sheet?.backgroundColor
|
|
224
|
+
}]
|
|
225
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
226
|
+
style: [styles.sheetSurface, {
|
|
227
|
+
backgroundColor: sheet?.backgroundColor,
|
|
228
|
+
borderTopLeftRadius: sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS,
|
|
229
|
+
borderTopRightRadius: sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS
|
|
230
|
+
}],
|
|
231
|
+
children: /*#__PURE__*/_jsx(OverlayLevelProvider, {
|
|
232
|
+
value: level,
|
|
233
|
+
children: children
|
|
234
|
+
})
|
|
235
|
+
})]
|
|
236
|
+
}) : /*#__PURE__*/_jsx(OverlayLevelProvider, {
|
|
122
237
|
value: level,
|
|
123
238
|
children: children
|
|
124
239
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useMemo","useState","StatusBar","StyleSheet","View","useWindowDimensions","NativeOverlay","OverlayLevelProvider","isBlockingLevel","useOverlayController","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULT_BACKDROP_COLOR","DEFAULT_SHEET_MAX_RATIO","REQUEST_REASONS","back","backdrop","pan","styles","create","host","position","top","left","width","OverlayView","props","level","presentation","blocking","dismissOnBackPress","sheet","keepContentMounted","statusBarStyle","children","testID","
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","useState","Pressable","StatusBar","StyleSheet","View","useWindowDimensions","NativeOverlay","OverlayLevelProvider","isBlockingLevel","resolveSheetWidth","useOverlayController","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DEFAULT_BACKDROP_COLOR","DEFAULT_SHEET_MAX_RATIO","DEFAULT_SHEET_CORNER_RADIUS","SHEET_SURFACE_TAIL_HEIGHT","REQUEST_REASONS","back","backdrop","pan","styles","create","host","position","top","left","width","sheetMarginLeft","bottom","sheetMarginRight","right","sheetSurface","borderCurve","overflow","flexGrow","sheetSurfaceTail","height","OverlayView","props","level","presentation","blocking","dismissOnBackPress","sheet","keepContentMounted","statusBarStyle","children","testID","windowOffsetRequest","onWindowOffset","offsetProbeRef","onHostWindowOrigin","event","x","nativeX","y","nativeY","nativeEvent","current","measureInWindow","isSheet","controller","entry","mounted","presented","ownsStatusBar","scope","hostKey","ownerKey","animation","onHostPresented","onHostDismissed","onHostRequestDismiss","measuredSheetHeight","setMeasuredSheetHeight","reportedSheetWidth","setReportedSheetWidth","containerWidth","sheetContainerWidth","inset","sheetInset","windowWidth","reportedWidth","maxWidth","hasSheetSurface","undefined","dismissOnBackdropPress","dismissOnPress","onSheetMarginPress","onSheetLayoutReport","maxSheetHeight","maxHeight","sheetHeight","Math","min","onSheetLayout","layout","animationConfig","JSON","stringify","isBlocking","onDismissed","onRequestDismiss","reason","statusBar","animated","barStyle","ref","collapsable","pointerEvents","style","visible","stackOrder","seq","backdropColor","color","sheetCornerRadius","cornerRadius","showHandle","sheetBackgroundColor","backgroundColor","dismissOnPanDown","onPresented","hostOriginRequest","onLayout","paddingHorizontal","flexShrink","accessible","importantForAccessibility","onPress","borderTopLeftRadius","borderTopRightRadius","value"],"sourceRoot":"../../src","sources":["OverlayView.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE9D,SACEC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,IAAI,EACJC,mBAAmB,QACd,cAAc;AAErB,OAAOC,aAAa,MAAM,gCAAgC;AAC1D,SAASC,oBAAoB,QAAQ,0BAAuB;AAC5D,SAASC,eAAe,QAAQ,oBAAiB;AACjD,SAASC,iBAAiB,QAAQ,iBAAc;AAChD,SAASC,oBAAoB,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC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AE7F,KAAM;UAAAO,QAAA,EAChCA;QAAQ,CACW;MAAC,CACnB;IACP,CACY,CAAC;EAAA,CAChB,CAAC;AAEP","ignoreList":[]}
|
|
@@ -268,6 +268,11 @@ function WebOverlayEntry({
|
|
|
268
268
|
left: 0,
|
|
269
269
|
right: 0,
|
|
270
270
|
bottom: 0,
|
|
271
|
+
// A max-width sheet is centered; the space beside it is
|
|
272
|
+
// the backdrop.
|
|
273
|
+
maxWidth: sheet.maxWidth,
|
|
274
|
+
marginLeft: 'auto',
|
|
275
|
+
marginRight: 'auto',
|
|
271
276
|
height: sheet.height,
|
|
272
277
|
maxHeight: sheet.maxHeight ?? DEFAULT_SHEET_MAX_HEIGHT,
|
|
273
278
|
display: 'flex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useId","useLayoutEffect","useRef","useSyncExternalStore","createPortal","StyleSheet","View","OverlayLevelProvider","OVERLAY_LEVEL_ORDER","isBlockingLevel","OVERLAY_OWNER_ATTRIBUTE","overlayStore","useOverlayController","animateBackdrop","animateTransition","ENTRY_ATTRIBUTE","getOverlayLayerRoot","getOverlayPageHost","registerOverlayDismissRequester","scheduleOverlayInertSync","subscribeOverlayPageHost","useKeyboardShift","useSheetDrag","jsx","_jsx","jsxs","_jsxs","DEFAULT_BACKDROP_COLOR","DEFAULT_SHEET_MAX_HEIGHT","DEFAULT_SHEET_CORNER_RADIUS","stopPropagation","event","ISOLATED_EVENT_HANDLERS","onClick","onPointerDown","onPointerUp","onKeyDown","WebOverlayEntry","entryId","parked","stackOrder","levelOrder","presented","animation","blocking","backdropColor","dismissOnBackdropPress","onPresented","onDismissed","onRequestDismiss","sheet","zIndex","ownerKey","testID","children","sheetRef","pannedAwayRef","isSheet","entryRef","contentRef","keyboardLayerRef","backdropRef","directionRef","undefined","runningAnimationsRef","restoreFocusRef","callbacksRef","current","style","removeProperty","opacity","content","direction","neverEntered","interruptedFrames","Map","running","target","effect","playState","HTMLElement","getComputedStyle","set","transform","cancel","focus","preventScroll","document","activeElement","contentRoot","firstElementChild","transition","enter","exit","backdrop","motion","filter","item","Promise","all","map","finished","then","catch","backdropNode","onBackdropClick","addEventListener","removeEventListener","layerRef","enabled","dismissOnPanDown","onDismissByPan","showBackdrop","cornerRadius","onKeyDownCapture","root","key","defaultPrevented","nativeEvent","isComposing","getBlockingTop","id","tabbable","Array","from","querySelectorAll","node","tabIndex","hasAttribute","matches","ancestor","parentElement","inert","hidden","getAttribute","display","visibility","sort","a","b","aOrder","Infinity","bOrder","active","first","last","length","contains","shiftKey","preventDefault","ref","role","position","inset","pointerEvents","outline","background","left","right","bottom","height","maxHeight","flexDirection","overflow","touchAction","backgroundColor","String","borderTopLeftRadius","borderTopRightRadius","showHandle","alignSelf","width","marginTop","borderRadius","flexShrink","absoluteFill","OverlayView","props","level","presentation","keepContentMounted","parkedId","entry","mounted","onHostPresented","onHostDismissed","onHostRequestDismiss","scope","hostKey","subscribePageHost","listener","getPageHost","pageHost","seq","color","dismissOnPress","value"],"sourceRoot":"../../src","sources":["OverlayView.web.tsx"],"mappings":";;AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,eAAe,EACfC,MAAM,EACNC,oBAAoB,QACf,OAAO;AAGd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,oBAAoB,QAAQ,0BAAuB;AAC5D,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,oBAAiB;AACtE,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,4BAAyB;AAC5E,SACEC,eAAe,EACfC,mBAAmB,EACnBC,kBAAkB,EAClBC,+BAA+B,EAC/BC,wBAAwB,EACxBC,wBAAwB,QACnB,wBAAqB;AAC5B,SAASC,gBAAgB,QAAQ,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KAAK,EAAEW,GAAG,IAAI,CAAC,CAAC,GACrDX,KAAK,EAAEW,GAAG,IAAI,CACnB;IACD7I,QAAQ,EAAEuI,KAAK,KAAK,MAAM,GAAGvI,QAAQ,GAAGW,SAAU;IAClDV,MAAM,EAAEA,MAAO;IAAAC,QAAA,eAEf9B,IAAA,CAACjB,oBAAoB;MAAC6L,KAAK,EAAElB,KAAM;MAAA5H,QAAA,EAAEA;IAAQ,CAAuB;EAAC,GAzBjE,OA0BW,CAAC,EAClBqI,KAAK,KAAK,MAAM,GAAGK,QAAQ,GAAIhL,mBAAmB,CAACkK,KAAK,CAC1D,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useId","useLayoutEffect","useRef","useSyncExternalStore","createPortal","StyleSheet","View","OverlayLevelProvider","OVERLAY_LEVEL_ORDER","isBlockingLevel","OVERLAY_OWNER_ATTRIBUTE","overlayStore","useOverlayController","animateBackdrop","animateTransition","ENTRY_ATTRIBUTE","getOverlayLayerRoot","getOverlayPageHost","registerOverlayDismissRequester","scheduleOverlayInertSync","subscribeOverlayPageHost","useKeyboardShift","useSheetDrag","jsx","_jsx","jsxs","_jsxs","DEFAULT_BACKDROP_COLOR","DEFAULT_SHEET_MAX_HEIGHT","DEFAULT_SHEET_CORNER_RADIUS","stopPropagation","event","ISOLATED_EVENT_HANDLERS","onClick","onPointerDown","onPointerUp","onKeyDown","WebOverlayEntry","entryId","parked","stackOrder","levelOrder","presented","animation","blocking","backdropColor","dismissOnBackdropPress","onPresented","onDismissed","onRequestDismiss","sheet","zIndex","ownerKey","testID","children","sheetRef","pannedAwayRef","isSheet","entryRef","contentRef","keyboardLayerRef","backdropRef","directionRef","undefined","runningAnimationsRef","restoreFocusRef","callbacksRef","current","style","removeProperty","opacity","content","direction","neverEntered","interruptedFrames","Map","running","target","effect","playState","HTMLElement","getComputedStyle","set","transform","cancel","focus","preventScroll","document","activeElement","contentRoot","firstElementChild","transition","enter","exit","backdrop","motion","filter","item","Promise","all","map","finished","then","catch","backdropNode","onBackdropClick","addEventListener","removeEventListener","layerRef","enabled","dismissOnPanDown","onDismissByPan","showBackdrop","cornerRadius","onKeyDownCapture","root","key","defaultPrevented","nativeEvent","isComposing","getBlockingTop","id","tabbable","Array","from","querySelectorAll","node","tabIndex","hasAttribute","matches","ancestor","parentElement","inert","hidden","getAttribute","display","visibility","sort","a","b","aOrder","Infinity","bOrder","active","first","last","length","contains","shiftKey","preventDefault","ref","role","position","inset","pointerEvents","outline","background","left","right","bottom","maxWidth","marginLeft","marginRight","height","maxHeight","flexDirection","overflow","touchAction","backgroundColor","String","borderTopLeftRadius","borderTopRightRadius","showHandle","alignSelf","width","marginTop","borderRadius","flexShrink","absoluteFill","OverlayView","props","level","presentation","keepContentMounted","parkedId","entry","mounted","onHostPresented","onHostDismissed","onHostRequestDismiss","scope","hostKey","subscribePageHost","listener","getPageHost","pageHost","seq","color","dismissOnPress","value"],"sourceRoot":"../../src","sources":["OverlayView.web.tsx"],"mappings":";;AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,eAAe,EACfC,MAAM,EACNC,oBAAoB,QACf,OAAO;AAGd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SAASC,oBAAoB,QAAQ,0BAAuB;AAC5D,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,oBAAiB;AACtE,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,4BAAyB;AAC5E,SACEC,eAAe,EACfC,mBAAmB,EACnBC,kBAAkB,EAClBC,+BAA+B,EAC/BC,wBAAwB,EACxBC,wBAAwB,QACnB,wBAAqB;AAC5B,SAASC,gBAAgB,QAAQ,2BAAwB;AACzD,SAASC,YAAY,QAAQ,uBAAoB;AAAC,SA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MAAM,GACZtL,mBAAmB,CAAC6K,KAAK,CAAC,GAAG,IAAI,IAAII,KAAK,EAAEW,GAAG,IAAI,CAAC,CAAC,GACrDX,KAAK,EAAEW,GAAG,IAAI,CACnB;IACDhJ,QAAQ,EAAE0I,KAAK,KAAK,MAAM,GAAG1I,QAAQ,GAAGW,SAAU;IAClDV,MAAM,EAAEA,MAAO;IAAAC,QAAA,eAEf9B,IAAA,CAACjB,oBAAoB;MAACgM,KAAK,EAAElB,KAAM;MAAA/H,QAAA,EAAEA;IAAQ,CAAuB;EAAC,GAzBjE,OA0BW,CAAC,EAClBwI,KAAK,KAAK,MAAM,GAAGK,QAAQ,GAAInL,mBAAmB,CAACqK,KAAK,CAC1D,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sheet content geometry. The content fills the width the platform gave the
|
|
5
|
+
* sheet (never wider than the window); `maxWidth` narrows it and the
|
|
6
|
+
* remaining space is split evenly as horizontal inset.
|
|
7
|
+
*/
|
|
8
|
+
export function resolveSheetWidth({
|
|
9
|
+
windowWidth,
|
|
10
|
+
reportedWidth,
|
|
11
|
+
maxWidth
|
|
12
|
+
}) {
|
|
13
|
+
const containerWidth = Math.min(reportedWidth ?? windowWidth, windowWidth);
|
|
14
|
+
const contentWidth = Math.max(0, Math.min(maxWidth ?? containerWidth, containerWidth));
|
|
15
|
+
return {
|
|
16
|
+
containerWidth,
|
|
17
|
+
contentWidth,
|
|
18
|
+
inset: (containerWidth - contentWidth) / 2
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sheetWidth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolveSheetWidth","windowWidth","reportedWidth","maxWidth","containerWidth","Math","min","contentWidth","max","inset"],"sourceRoot":"../../src","sources":["sheetWidth.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,iBAAiBA,CAAC;EAChCC,WAAW;EACXC,aAAa;EACbC;AAKF,CAAC,EAAmE;EAClE,MAAMC,cAAc,GAAGC,IAAI,CAACC,GAAG,CAACJ,aAAa,IAAID,WAAW,EAAEA,WAAW,CAAC;EAC1E,MAAMM,YAAY,GAAGF,IAAI,CAACG,GAAG,CAC3B,CAAC,EACDH,IAAI,CAACC,GAAG,CAACH,QAAQ,IAAIC,cAAc,EAAEA,cAAc,CACrD,CAAC;EACD,OAAO;IACLA,cAAc;IACdG,YAAY;IACZE,KAAK,EAAE,CAACL,cAAc,GAAGG,YAAY,IAAI;EAC3C,CAAC;AACH","ignoreList":[]}
|
|
@@ -5,6 +5,13 @@ type INativeOverlayDismissedEvent = Readonly<{
|
|
|
5
5
|
type INativeOverlayRequestDismissEvent = Readonly<{
|
|
6
6
|
reason: string;
|
|
7
7
|
}>;
|
|
8
|
+
type INativeOverlayHostWindowOriginEvent = Readonly<{
|
|
9
|
+
x: CodegenTypes.Double;
|
|
10
|
+
y: CodegenTypes.Double;
|
|
11
|
+
}>;
|
|
12
|
+
type INativeOverlaySheetLayoutEvent = Readonly<{
|
|
13
|
+
width: CodegenTypes.Double;
|
|
14
|
+
}>;
|
|
8
15
|
type INativeOverlayPresentedEvent = Readonly<{
|
|
9
16
|
stackOrder: CodegenTypes.Int32;
|
|
10
17
|
}>;
|
|
@@ -35,6 +42,11 @@ export interface INativeOverlayNativeProps extends ViewProps {
|
|
|
35
42
|
onPresented?: CodegenTypes.DirectEventHandler<INativeOverlayPresentedEvent>;
|
|
36
43
|
onDismissed?: CodegenTypes.DirectEventHandler<INativeOverlayDismissedEvent>;
|
|
37
44
|
onRequestDismiss?: CodegenTypes.DirectEventHandler<INativeOverlayRequestDismissEvent>;
|
|
45
|
+
/** `sheet` presentation: the width the platform gave the sheet. */
|
|
46
|
+
onSheetLayout?: CodegenTypes.DirectEventHandler<INativeOverlaySheetLayoutEvent>;
|
|
47
|
+
/** Bump to have native report this host's on-screen origin once. */
|
|
48
|
+
hostOriginRequest?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
49
|
+
onHostWindowOrigin?: CodegenTypes.DirectEventHandler<INativeOverlayHostWindowOriginEvent>;
|
|
38
50
|
}
|
|
39
51
|
declare const _default: HostComponent<INativeOverlayNativeProps>;
|
|
40
52
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeOverlayNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/NativeOverlayNativeComponent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,KAAK,4BAA4B,GAAG,QAAQ,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,KAAK,iCAAiC,GAAG,QAAQ,CAAC;IAChD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,KAAK,4BAA4B,GAAG,QAAQ,CAAC;IAC3C,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D,2FAA2F;IAC3F,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC,WAAW,CAC9B,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,EAC5D,OAAO,CACR,CAAC;IACF,YAAY,CAAC,EAAE,YAAY,CAAC,WAAW,CACrC,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,EACxD,QAAQ,CACT,CAAC;IACF,KAAK,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,QAAQ,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9D,4EAA4E;IAC5E,OAAO,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,EAA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,CAAC,kBAAkB,CAAC,8BAA8B,CAAC,CAAC;IAChF,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpE,kBAAkB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC,CAAC;CAC3F;wBAOI,aAAa,CAAC,yBAAyB,CAAC;AAH7C,wBAG8C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayView.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OverlayView.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAuC5B,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,kDAqOnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayView.web.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.web.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayView.web.d.ts","sourceRoot":"","sources":["../../../src/OverlayView.web.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAGV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAuY5B,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,sCA2EnD"}
|
|
@@ -13,6 +13,11 @@ export interface IOverlaySheetOptions {
|
|
|
13
13
|
height?: number;
|
|
14
14
|
/** Defaults to 92% of the window height. */
|
|
15
15
|
maxHeight?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Caps the content width; a sheet wider than this centers the content.
|
|
18
|
+
* The content otherwise fills the width the platform gave the sheet.
|
|
19
|
+
*/
|
|
20
|
+
maxWidth?: number;
|
|
16
21
|
cornerRadius?: number;
|
|
17
22
|
showHandle?: boolean;
|
|
18
23
|
backgroundColor?: ColorValue;
|
|
@@ -60,6 +65,18 @@ export interface IOverlayViewProps {
|
|
|
60
65
|
*/
|
|
61
66
|
onRequestDismiss?: (reason: IOverlayRequestDismissReason) => void;
|
|
62
67
|
onPresented?: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* Native only. Window coordinates measured in JS (`measureInWindow`) are
|
|
70
|
+
* relative to the enclosing native modal (react-native-screens), not the
|
|
71
|
+
* screen. Change `windowOffsetRequest` to receive the offset to add to such
|
|
72
|
+
* coordinates so they match where the overlay draws; it is `{0, 0}` outside
|
|
73
|
+
* modals and on Android.
|
|
74
|
+
*/
|
|
75
|
+
windowOffsetRequest?: number;
|
|
76
|
+
onWindowOffset?: (offset: {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
}) => void;
|
|
63
80
|
/** The exit animation finished and the content unmounted. */
|
|
64
81
|
onClose?: (reason: IOverlayDismissReason) => void;
|
|
65
82
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayViewTypes.d.ts","sourceRoot":"","sources":["../../../src/OverlayViewTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,cAAc,C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,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,mCAAmC;IACnC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,KAAK,CAAC;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,CAAC;IAClE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,6DAA6D;IAC7D,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sheet content geometry. The content fills the width the platform gave the
|
|
3
|
+
* sheet (never wider than the window); `maxWidth` narrows it and the
|
|
4
|
+
* remaining space is split evenly as horizontal inset.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveSheetWidth({ windowWidth, reportedWidth, maxWidth, }: {
|
|
7
|
+
windowWidth: number;
|
|
8
|
+
reportedWidth?: number;
|
|
9
|
+
maxWidth?: number;
|
|
10
|
+
}): {
|
|
11
|
+
containerWidth: number;
|
|
12
|
+
contentWidth: number;
|
|
13
|
+
inset: number;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=sheetWidth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetWidth.d.ts","sourceRoot":"","sources":["../../../src/sheetWidth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,aAAa,EACb,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAWlE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-overlay",
|
|
3
|
-
"version": "6.7.0-alpha.
|
|
3
|
+
"version": "6.7.0-alpha.386",
|
|
4
4
|
"description": "Native and Web overlay hosts with ordered levels, page scope and Fabric measurement",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -14,6 +14,15 @@ type INativeOverlayRequestDismissEvent = Readonly<{
|
|
|
14
14
|
reason: string;
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
|
+
type INativeOverlayHostWindowOriginEvent = Readonly<{
|
|
18
|
+
x: CodegenTypes.Double;
|
|
19
|
+
y: CodegenTypes.Double;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
type INativeOverlaySheetLayoutEvent = Readonly<{
|
|
23
|
+
width: CodegenTypes.Double;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
17
26
|
type INativeOverlayPresentedEvent = Readonly<{
|
|
18
27
|
stackOrder: CodegenTypes.Int32;
|
|
19
28
|
}>;
|
|
@@ -51,6 +60,11 @@ export interface INativeOverlayNativeProps extends ViewProps {
|
|
|
51
60
|
onPresented?: CodegenTypes.DirectEventHandler<INativeOverlayPresentedEvent>;
|
|
52
61
|
onDismissed?: CodegenTypes.DirectEventHandler<INativeOverlayDismissedEvent>;
|
|
53
62
|
onRequestDismiss?: CodegenTypes.DirectEventHandler<INativeOverlayRequestDismissEvent>;
|
|
63
|
+
/** `sheet` presentation: the width the platform gave the sheet. */
|
|
64
|
+
onSheetLayout?: CodegenTypes.DirectEventHandler<INativeOverlaySheetLayoutEvent>;
|
|
65
|
+
/** Bump to have native report this host's on-screen origin once. */
|
|
66
|
+
hostOriginRequest?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
67
|
+
onHostWindowOrigin?: CodegenTypes.DirectEventHandler<INativeOverlayHostWindowOriginEvent>;
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
// The shadow node is hand-written (common/cpp): it carries the on-screen
|
package/src/OverlayView.tsx
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
1
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Pressable,
|
|
5
|
+
StatusBar,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
View,
|
|
8
|
+
useWindowDimensions,
|
|
9
|
+
} from 'react-native';
|
|
4
10
|
|
|
5
11
|
import NativeOverlay from './NativeOverlayNativeComponent';
|
|
6
12
|
import { OverlayLevelProvider } from './OverlayLevelContext';
|
|
7
13
|
import { isBlockingLevel } from './OverlayLevels';
|
|
14
|
+
import { resolveSheetWidth } from './sheetWidth';
|
|
8
15
|
import { useOverlayController } from './useOverlayController';
|
|
9
16
|
|
|
10
17
|
import type {
|
|
11
18
|
IOverlayRequestDismissReason,
|
|
12
19
|
IOverlayViewProps,
|
|
13
20
|
} from './OverlayViewTypes';
|
|
21
|
+
import type { ComponentRef } from 'react';
|
|
14
22
|
import type { LayoutChangeEvent, NativeSyntheticEvent } from 'react-native';
|
|
15
23
|
|
|
16
24
|
const DEFAULT_BACKDROP_COLOR = 'rgba(0, 0, 0, 0.4)';
|
|
17
25
|
const DEFAULT_SHEET_MAX_RATIO = 0.92;
|
|
26
|
+
const DEFAULT_SHEET_CORNER_RADIUS = 24;
|
|
27
|
+
// Taller than any bottom safe area; the sheet clips the rest.
|
|
28
|
+
const SHEET_SURFACE_TAIL_HEIGHT = 120;
|
|
18
29
|
|
|
19
30
|
const REQUEST_REASONS: Record<string, IOverlayRequestDismissReason> = {
|
|
20
31
|
back: 'back',
|
|
@@ -33,6 +44,16 @@ const styles = StyleSheet.create({
|
|
|
33
44
|
left: 0,
|
|
34
45
|
width: 0,
|
|
35
46
|
},
|
|
47
|
+
sheetMarginLeft: { position: 'absolute', top: 0, bottom: 0, left: 0 },
|
|
48
|
+
sheetMarginRight: { position: 'absolute', top: 0, bottom: 0, right: 0 },
|
|
49
|
+
sheetSurface: { borderCurve: 'continuous', overflow: 'hidden', flexGrow: 1 },
|
|
50
|
+
// The platform sheet extends below the content (home indicator area); the
|
|
51
|
+
// drawn surface continues into it so no backdrop shows under the content.
|
|
52
|
+
sheetSurfaceTail: {
|
|
53
|
+
position: 'absolute',
|
|
54
|
+
top: '100%',
|
|
55
|
+
height: SHEET_SURFACE_TAIL_HEIGHT,
|
|
56
|
+
},
|
|
36
57
|
});
|
|
37
58
|
|
|
38
59
|
export function OverlayView(props: IOverlayViewProps) {
|
|
@@ -47,7 +68,22 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
47
68
|
statusBarStyle,
|
|
48
69
|
children,
|
|
49
70
|
testID,
|
|
71
|
+
windowOffsetRequest,
|
|
72
|
+
onWindowOffset,
|
|
50
73
|
} = props;
|
|
74
|
+
// A plain sibling at the host's spot: its JS-measured origin shares the
|
|
75
|
+
// modal-relative space of the caller's measurements, while native reports
|
|
76
|
+
// the true one (the host's own shadow node reports the content origin).
|
|
77
|
+
const offsetProbeRef = useRef<ComponentRef<typeof View>>(null);
|
|
78
|
+
const onHostWindowOrigin = useCallback(
|
|
79
|
+
(event: NativeSyntheticEvent<{ x: number; y: number }>) => {
|
|
80
|
+
const { x: nativeX, y: nativeY } = event.nativeEvent;
|
|
81
|
+
offsetProbeRef.current?.measureInWindow((x, y) => {
|
|
82
|
+
onWindowOffset?.({ x: nativeX - x, y: nativeY - y });
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
[onWindowOffset]
|
|
86
|
+
);
|
|
51
87
|
const isSheet = presentation === 'sheet';
|
|
52
88
|
const controller = useOverlayController(props);
|
|
53
89
|
const { width, height } = useWindowDimensions();
|
|
@@ -66,6 +102,30 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
66
102
|
} = controller;
|
|
67
103
|
|
|
68
104
|
const [measuredSheetHeight, setMeasuredSheetHeight] = useState(0);
|
|
105
|
+
// iOS sizes a sheet itself (narrower than the window on wide windows), so
|
|
106
|
+
// the content follows the width native reports; Android sheets span the
|
|
107
|
+
// window and never report.
|
|
108
|
+
const [reportedSheetWidth, setReportedSheetWidth] = useState<number>();
|
|
109
|
+
const { containerWidth: sheetContainerWidth, inset: sheetInset } =
|
|
110
|
+
resolveSheetWidth({
|
|
111
|
+
windowWidth: width,
|
|
112
|
+
reportedWidth: reportedSheetWidth,
|
|
113
|
+
maxWidth: sheet?.maxWidth,
|
|
114
|
+
});
|
|
115
|
+
// `maxWidth` turns on the drawn surface even while it spans the whole sheet,
|
|
116
|
+
// so a width change never swaps who paints the background.
|
|
117
|
+
const hasSheetSurface = isSheet && sheet?.maxWidth !== undefined;
|
|
118
|
+
const dismissOnBackdropPress = backdrop ? !!backdrop.dismissOnPress : false;
|
|
119
|
+
const onSheetMarginPress = useCallback(() => {
|
|
120
|
+
// The margins beside a max-width surface stand in for the backdrop.
|
|
121
|
+
if (dismissOnBackdropPress) onHostRequestDismiss('backdrop');
|
|
122
|
+
}, [dismissOnBackdropPress, onHostRequestDismiss]);
|
|
123
|
+
const onSheetLayoutReport = useCallback(
|
|
124
|
+
(event: NativeSyntheticEvent<{ width: number }>) => {
|
|
125
|
+
setReportedSheetWidth(event.nativeEvent.width);
|
|
126
|
+
},
|
|
127
|
+
[]
|
|
128
|
+
);
|
|
69
129
|
const maxSheetHeight = sheet?.maxHeight ?? height * DEFAULT_SHEET_MAX_RATIO;
|
|
70
130
|
const sheetHeight = Math.min(
|
|
71
131
|
sheet?.height ?? measuredSheetHeight,
|
|
@@ -104,6 +164,14 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
104
164
|
return (
|
|
105
165
|
<>
|
|
106
166
|
{statusBar}
|
|
167
|
+
{onWindowOffset ? (
|
|
168
|
+
<View
|
|
169
|
+
ref={offsetProbeRef}
|
|
170
|
+
collapsable={false}
|
|
171
|
+
pointerEvents="none"
|
|
172
|
+
style={styles.host}
|
|
173
|
+
/>
|
|
174
|
+
) : null}
|
|
107
175
|
<NativeOverlay
|
|
108
176
|
style={styles.host}
|
|
109
177
|
// A fitted sheet presents once its content height is known.
|
|
@@ -123,12 +191,19 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
123
191
|
sheetHeight={isSheet ? sheetHeight : 0}
|
|
124
192
|
sheetCornerRadius={sheet?.cornerRadius}
|
|
125
193
|
showHandle={sheet?.showHandle}
|
|
126
|
-
|
|
194
|
+
// A max-width sheet draws its own surface, so the platform sheet
|
|
195
|
+
// stays transparent beside it.
|
|
196
|
+
sheetBackgroundColor={
|
|
197
|
+
hasSheetSurface ? 'transparent' : sheet?.backgroundColor
|
|
198
|
+
}
|
|
127
199
|
dismissOnPanDown={sheet?.dismissOnPanDown ?? true}
|
|
128
200
|
animationConfig={animationConfig}
|
|
129
201
|
onPresented={onHostPresented}
|
|
130
202
|
onDismissed={onDismissed}
|
|
131
203
|
onRequestDismiss={onRequestDismiss}
|
|
204
|
+
onSheetLayout={isSheet ? onSheetLayoutReport : undefined}
|
|
205
|
+
hostOriginRequest={onWindowOffset ? windowOffsetRequest ?? 0 : 0}
|
|
206
|
+
onHostWindowOrigin={onWindowOffset ? onHostWindowOrigin : undefined}
|
|
132
207
|
testID={testID}
|
|
133
208
|
>
|
|
134
209
|
{isSheet ? (
|
|
@@ -136,7 +211,8 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
136
211
|
collapsable={false}
|
|
137
212
|
onLayout={onSheetLayout}
|
|
138
213
|
style={{
|
|
139
|
-
width,
|
|
214
|
+
width: sheetContainerWidth,
|
|
215
|
+
paddingHorizontal: sheetInset,
|
|
140
216
|
height: sheet?.height,
|
|
141
217
|
maxHeight: maxSheetHeight,
|
|
142
218
|
// The host is 0x0; without this Yoga shrinks the content to 0 and
|
|
@@ -144,9 +220,56 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
144
220
|
flexShrink: 0,
|
|
145
221
|
}}
|
|
146
222
|
>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
223
|
+
{hasSheetSurface ? (
|
|
224
|
+
<>
|
|
225
|
+
{sheetInset > 0 ? (
|
|
226
|
+
<>
|
|
227
|
+
<Pressable
|
|
228
|
+
accessible={false}
|
|
229
|
+
importantForAccessibility="no-hide-descendants"
|
|
230
|
+
onPress={onSheetMarginPress}
|
|
231
|
+
style={[styles.sheetMarginLeft, { width: sheetInset }]}
|
|
232
|
+
/>
|
|
233
|
+
<Pressable
|
|
234
|
+
accessible={false}
|
|
235
|
+
importantForAccessibility="no-hide-descendants"
|
|
236
|
+
onPress={onSheetMarginPress}
|
|
237
|
+
style={[styles.sheetMarginRight, { width: sheetInset }]}
|
|
238
|
+
/>
|
|
239
|
+
</>
|
|
240
|
+
) : null}
|
|
241
|
+
<View
|
|
242
|
+
style={[
|
|
243
|
+
styles.sheetSurfaceTail,
|
|
244
|
+
{
|
|
245
|
+
left: sheetInset,
|
|
246
|
+
right: sheetInset,
|
|
247
|
+
backgroundColor: sheet?.backgroundColor,
|
|
248
|
+
},
|
|
249
|
+
]}
|
|
250
|
+
/>
|
|
251
|
+
<View
|
|
252
|
+
style={[
|
|
253
|
+
styles.sheetSurface,
|
|
254
|
+
{
|
|
255
|
+
backgroundColor: sheet?.backgroundColor,
|
|
256
|
+
borderTopLeftRadius:
|
|
257
|
+
sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS,
|
|
258
|
+
borderTopRightRadius:
|
|
259
|
+
sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS,
|
|
260
|
+
},
|
|
261
|
+
]}
|
|
262
|
+
>
|
|
263
|
+
<OverlayLevelProvider value={level}>
|
|
264
|
+
{children}
|
|
265
|
+
</OverlayLevelProvider>
|
|
266
|
+
</View>
|
|
267
|
+
</>
|
|
268
|
+
) : (
|
|
269
|
+
<OverlayLevelProvider value={level}>
|
|
270
|
+
{children}
|
|
271
|
+
</OverlayLevelProvider>
|
|
272
|
+
)}
|
|
150
273
|
</View>
|
|
151
274
|
) : (
|
|
152
275
|
<View
|
package/src/OverlayView.web.tsx
CHANGED
|
@@ -371,6 +371,11 @@ function WebOverlayEntry({
|
|
|
371
371
|
left: 0,
|
|
372
372
|
right: 0,
|
|
373
373
|
bottom: 0,
|
|
374
|
+
// A max-width sheet is centered; the space beside it is
|
|
375
|
+
// the backdrop.
|
|
376
|
+
maxWidth: sheet.maxWidth,
|
|
377
|
+
marginLeft: 'auto',
|
|
378
|
+
marginRight: 'auto',
|
|
374
379
|
height: sheet.height,
|
|
375
380
|
maxHeight: sheet.maxHeight ?? DEFAULT_SHEET_MAX_HEIGHT,
|
|
376
381
|
display: 'flex',
|
package/src/OverlayViewTypes.ts
CHANGED
|
@@ -26,6 +26,11 @@ export interface IOverlaySheetOptions {
|
|
|
26
26
|
height?: number;
|
|
27
27
|
/** Defaults to 92% of the window height. */
|
|
28
28
|
maxHeight?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Caps the content width; a sheet wider than this centers the content.
|
|
31
|
+
* The content otherwise fills the width the platform gave the sheet.
|
|
32
|
+
*/
|
|
33
|
+
maxWidth?: number;
|
|
29
34
|
cornerRadius?: number;
|
|
30
35
|
showHandle?: boolean;
|
|
31
36
|
backgroundColor?: ColorValue;
|
|
@@ -74,6 +79,15 @@ export interface IOverlayViewProps {
|
|
|
74
79
|
*/
|
|
75
80
|
onRequestDismiss?: (reason: IOverlayRequestDismissReason) => void;
|
|
76
81
|
onPresented?: () => void;
|
|
82
|
+
/**
|
|
83
|
+
* Native only. Window coordinates measured in JS (`measureInWindow`) are
|
|
84
|
+
* relative to the enclosing native modal (react-native-screens), not the
|
|
85
|
+
* screen. Change `windowOffsetRequest` to receive the offset to add to such
|
|
86
|
+
* coordinates so they match where the overlay draws; it is `{0, 0}` outside
|
|
87
|
+
* modals and on Android.
|
|
88
|
+
*/
|
|
89
|
+
windowOffsetRequest?: number;
|
|
90
|
+
onWindowOffset?: (offset: { x: number; y: number }) => void;
|
|
77
91
|
/** The exit animation finished and the content unmounted. */
|
|
78
92
|
onClose?: (reason: IOverlayDismissReason) => void;
|
|
79
93
|
children?: ReactNode;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sheet content geometry. The content fills the width the platform gave the
|
|
3
|
+
* sheet (never wider than the window); `maxWidth` narrows it and the
|
|
4
|
+
* remaining space is split evenly as horizontal inset.
|
|
5
|
+
*/
|
|
6
|
+
export function resolveSheetWidth({
|
|
7
|
+
windowWidth,
|
|
8
|
+
reportedWidth,
|
|
9
|
+
maxWidth,
|
|
10
|
+
}: {
|
|
11
|
+
windowWidth: number;
|
|
12
|
+
reportedWidth?: number;
|
|
13
|
+
maxWidth?: number;
|
|
14
|
+
}): { containerWidth: number; contentWidth: number; inset: number } {
|
|
15
|
+
const containerWidth = Math.min(reportedWidth ?? windowWidth, windowWidth);
|
|
16
|
+
const contentWidth = Math.max(
|
|
17
|
+
0,
|
|
18
|
+
Math.min(maxWidth ?? containerWidth, containerWidth)
|
|
19
|
+
);
|
|
20
|
+
return {
|
|
21
|
+
containerWidth,
|
|
22
|
+
contentWidth,
|
|
23
|
+
inset: (containerWidth - contentWidth) / 2,
|
|
24
|
+
};
|
|
25
|
+
}
|