@onekeyfe/react-native-native-overlay 6.7.0-19 → 6.7.0-20
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 +112 -0
- package/ios/NativeOverlayContainerView.swift +15 -0
- package/ios/RCTNativeOverlayComponentView.mm +51 -0
- package/lib/module/NativeOverlayNativeComponent.ts +14 -0
- package/lib/module/OverlayView.js +124 -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 +139 -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,115 @@ 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
|
+
- Without `sheet.backgroundColor`, both the drawn content surface and its
|
|
386
|
+
bottom safe-area tail keep the native default: iOS `systemBackground` or
|
|
387
|
+
Android's theme `colorBackground`. Explicit colors, including transparent,
|
|
388
|
+
take precedence. The platform sheet remains transparent beside the surface.
|
|
389
|
+
- The side margins behave as backdrop for taps: a tap there follows
|
|
390
|
+
`dismissOnBackdropPress`, and the margins are hidden from accessibility.
|
|
391
|
+
Known divergence: on iOS and Android the platform sheet owns the drag, so a
|
|
392
|
+
pan that starts on a margin still moves the sheet. On Web the margins are
|
|
393
|
+
the real backdrop.
|
|
394
|
+
- Setting `maxWidth` always switches to the drawn surface, even while it
|
|
395
|
+
spans the whole sheet, so a width change never swaps which side paints the
|
|
396
|
+
background.
|
|
397
|
+
- In compact windows the sheet is never wider than `maxWidth`, so the
|
|
398
|
+
max-width sheet and the full-width sheet are identical there.
|
|
399
|
+
|
|
400
|
+
Width changes while open (rotation, folding, window resize):
|
|
401
|
+
|
|
402
|
+
| Change | Anchored panel | Sheet | Centered card |
|
|
403
|
+
|---|---|---|---|
|
|
404
|
+
| Within one class | repositions to its anchor | surface width follows | stays centered |
|
|
405
|
+
| Across classes | closes | surface width follows | switches presentation in place, keeping content and input |
|
|
406
|
+
|
|
407
|
+
Open questions: whether the anchored panel should reopen as a sheet instead
|
|
408
|
+
of closing when the class drops below expanded.
|
|
409
|
+
|
|
410
|
+
### Window offset for modal-relative anchors
|
|
411
|
+
|
|
412
|
+
Implemented; iOS runtime-verified on an iPhone Duo inner display. Under
|
|
413
|
+
Fabric, `measureInWindow` / `measure` inside a react-native-screens native
|
|
414
|
+
modal return coordinates relative to that modal, not the screen (measured
|
|
415
|
+
offset of 150, 8 pt for the account selector page sheet in landscape), and no
|
|
416
|
+
JS API exposes the modal's position. Anchored overlays draw in screen
|
|
417
|
+
coordinates, so callers that anchor to a JS-measured rect ask the overlay for
|
|
418
|
+
the correction:
|
|
419
|
+
|
|
420
|
+
- `windowOffsetRequest` (a counter) and `onWindowOffset({ x, y })`. Each new
|
|
421
|
+
non-zero value makes iOS report the host's on-screen origin once, after the
|
|
422
|
+
commit settles; JS measures a plain sibling probe at the same spot and
|
|
423
|
+
reports `native - measured`. It is `{0, 0}` outside modals. A request that
|
|
424
|
+
arrives before window attachment or event-emitter setup stays pending and
|
|
425
|
+
retries after those dependencies attach. It is consumed only after emitting;
|
|
426
|
+
zero cancels a pending request, and a newer value supersedes it.
|
|
427
|
+
- The host's own shadow node reports the content origin, so the probe is a
|
|
428
|
+
separate view.
|
|
429
|
+
- The overlay must be mounted to report, so callers keep it mounted
|
|
430
|
+
(hidden) while waiting. Android never reports; callers treat a missing
|
|
431
|
+
report as no offset only where the platform cannot report.
|
|
432
|
+
- Rects already in screen space (for example from native lists) need no
|
|
433
|
+
correction.
|
|
434
|
+
|
|
326
435
|
### Web keyboard focus containment
|
|
327
436
|
|
|
328
437
|
The topmost active, unsuspended blocking Web entry MUST contain sequential
|
|
@@ -529,6 +638,9 @@ P2 sheet notes:
|
|
|
529
638
|
the next dismissal follows the normal exit path and restores focus.
|
|
530
639
|
Cancelling a tracked pointer resets its drag offset, transition and backdrop
|
|
531
640
|
without dismissing the sheet or swallowing a later click.
|
|
641
|
+
- Sheet content width follows the native `onSheetLayout` report and
|
|
642
|
+
`sheet.maxWidth` (see Sheet content width); `resolveSheetWidth` is unit
|
|
643
|
+
tested in `__tests__/sheetWidth.test.ts`.
|
|
532
644
|
- A fitted sheet measures its content with `onLayout` before presenting.
|
|
533
645
|
Hidden content stays mounted inside the zero-width host (clipped on iOS,
|
|
534
646
|
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,9 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
63
63
|
RCTSurfaceTouchHandler *_touchHandler;
|
|
64
64
|
RNCNativeOverlayShadowNode::ConcreteState::Shared _state;
|
|
65
65
|
CGPoint _contentOffset;
|
|
66
|
+
int32_t _hostOriginRequest;
|
|
67
|
+
int32_t _reportedHostOriginRequest;
|
|
68
|
+
BOOL _hostOriginReportScheduled;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
@@ -104,6 +107,13 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
104
107
|
NSString *reason = body[@"reason"] ?: @"system";
|
|
105
108
|
emitter->onDismissed({.reason = std::string(reason.UTF8String)});
|
|
106
109
|
};
|
|
110
|
+
_containerView.onSheetLayout = ^(CGFloat width) {
|
|
111
|
+
auto strongSelf = weakSelf;
|
|
112
|
+
if (!strongSelf) return;
|
|
113
|
+
auto emitter = std::static_pointer_cast<const RNCNativeOverlayEventEmitter>(strongSelf->_eventEmitter);
|
|
114
|
+
if (!emitter) return;
|
|
115
|
+
emitter->onSheetLayout({.width = width});
|
|
116
|
+
};
|
|
107
117
|
_containerView.onRequestDismiss = ^(NSDictionary *body) {
|
|
108
118
|
auto strongSelf = weakSelf;
|
|
109
119
|
if (!strongSelf) return;
|
|
@@ -157,9 +167,48 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
157
167
|
_containerView.visible = newProps.visible;
|
|
158
168
|
[_containerView commitConfiguration];
|
|
159
169
|
|
|
170
|
+
_hostOriginRequest = newProps.hostOriginRequest;
|
|
171
|
+
if (_hostOriginRequest == 0) _reportedHostOriginRequest = 0;
|
|
172
|
+
[self scheduleHostWindowOrigin];
|
|
173
|
+
|
|
160
174
|
[super updateProps:props oldProps:oldProps];
|
|
161
175
|
}
|
|
162
176
|
|
|
177
|
+
- (void)didMoveToWindow
|
|
178
|
+
{
|
|
179
|
+
[super didMoveToWindow];
|
|
180
|
+
[self scheduleHostWindowOrigin];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
- (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
|
|
184
|
+
{
|
|
185
|
+
[super updateEventEmitter:eventEmitter];
|
|
186
|
+
[self scheduleHostWindowOrigin];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
- (void)scheduleHostWindowOrigin
|
|
190
|
+
{
|
|
191
|
+
if (_hostOriginRequest == 0 || _hostOriginRequest == _reportedHostOriginRequest || _hostOriginReportScheduled) return;
|
|
192
|
+
_hostOriginReportScheduled = YES;
|
|
193
|
+
__weak auto weakSelf = self;
|
|
194
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
195
|
+
auto strongSelf = weakSelf;
|
|
196
|
+
if (!strongSelf) return;
|
|
197
|
+
strongSelf->_hostOriginReportScheduled = NO;
|
|
198
|
+
const auto request = strongSelf->_hostOriginRequest;
|
|
199
|
+
// Mounting can deliver props before the window or event emitter. Keep
|
|
200
|
+
// the request pending until both are ready; attachment retries it.
|
|
201
|
+
if (request == 0 || request == strongSelf->_reportedHostOriginRequest || !strongSelf.window) return;
|
|
202
|
+
auto emitter = std::static_pointer_cast<const RNCNativeOverlayEventEmitter>(strongSelf->_eventEmitter);
|
|
203
|
+
if (!emitter) return;
|
|
204
|
+
CGPoint origin = [strongSelf convertPoint:CGPointZero toView:nil];
|
|
205
|
+
origin.x += strongSelf.window.frame.origin.x;
|
|
206
|
+
origin.y += strongSelf.window.frame.origin.y;
|
|
207
|
+
strongSelf->_reportedHostOriginRequest = request;
|
|
208
|
+
emitter->onHostWindowOrigin({.x = origin.x, .y = origin.y});
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
163
212
|
- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState
|
|
164
213
|
{
|
|
165
214
|
_state = std::static_pointer_cast<RNCNativeOverlayShadowNode::ConcreteState const>(state);
|
|
@@ -181,6 +230,8 @@ static NSString *RNCNativeOverlayPresentationString(RNCNativeOverlayPresentation
|
|
|
181
230
|
|
|
182
231
|
- (void)invalidate
|
|
183
232
|
{
|
|
233
|
+
_hostOriginRequest = 0;
|
|
234
|
+
_reportedHostOriginRequest = 0;
|
|
184
235
|
[_containerView invalidate];
|
|
185
236
|
[super invalidate];
|
|
186
237
|
}
|
|
@@ -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 { Platform, PlatformColor, 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,30 @@ 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 sheetSurfaceBackgroundColor = sheet?.backgroundColor ?? PlatformColor(Platform.OS === 'ios' ? 'systemBackground' : '?android:attr/colorBackground');
|
|
124
|
+
const dismissOnBackdropPress = backdrop ? !!backdrop.dismissOnPress : false;
|
|
125
|
+
const onSheetMarginPress = useCallback(() => {
|
|
126
|
+
// The margins beside a max-width surface stand in for the backdrop.
|
|
127
|
+
if (dismissOnBackdropPress) onHostRequestDismiss('backdrop');
|
|
128
|
+
}, [dismissOnBackdropPress, onHostRequestDismiss]);
|
|
129
|
+
const onSheetLayoutReport = useCallback(event => {
|
|
130
|
+
setReportedSheetWidth(event.nativeEvent.width);
|
|
131
|
+
}, []);
|
|
62
132
|
const maxSheetHeight = sheet?.maxHeight ?? height * DEFAULT_SHEET_MAX_RATIO;
|
|
63
133
|
const sheetHeight = Math.min(sheet?.height ?? measuredSheetHeight, maxSheetHeight);
|
|
64
134
|
const onSheetLayout = useCallback(event => {
|
|
@@ -82,7 +152,12 @@ export function OverlayView(props) {
|
|
|
82
152
|
barStyle: statusBarStyle === 'light' ? 'light-content' : 'dark-content'
|
|
83
153
|
}) : null;
|
|
84
154
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
85
|
-
children: [statusBar, /*#__PURE__*/_jsx(
|
|
155
|
+
children: [statusBar, onWindowOffset ? /*#__PURE__*/_jsx(View, {
|
|
156
|
+
ref: offsetProbeRef,
|
|
157
|
+
collapsable: false,
|
|
158
|
+
pointerEvents: "none",
|
|
159
|
+
style: styles.host
|
|
160
|
+
}) : null, /*#__PURE__*/_jsx(NativeOverlay, {
|
|
86
161
|
style: styles.host
|
|
87
162
|
// A fitted sheet presents once its content height is known.
|
|
88
163
|
,
|
|
@@ -99,26 +174,67 @@ export function OverlayView(props) {
|
|
|
99
174
|
backdropColor: backdrop ? backdrop.color ?? DEFAULT_BACKDROP_COLOR : undefined,
|
|
100
175
|
sheetHeight: isSheet ? sheetHeight : 0,
|
|
101
176
|
sheetCornerRadius: sheet?.cornerRadius,
|
|
102
|
-
showHandle: sheet?.showHandle
|
|
103
|
-
|
|
177
|
+
showHandle: sheet?.showHandle
|
|
178
|
+
// A max-width sheet draws its own surface, so the platform sheet
|
|
179
|
+
// stays transparent beside it.
|
|
180
|
+
,
|
|
181
|
+
sheetBackgroundColor: hasSheetSurface ? 'transparent' : sheet?.backgroundColor,
|
|
104
182
|
dismissOnPanDown: sheet?.dismissOnPanDown ?? true,
|
|
105
183
|
animationConfig: animationConfig,
|
|
106
184
|
onPresented: onHostPresented,
|
|
107
185
|
onDismissed: onDismissed,
|
|
108
186
|
onRequestDismiss: onRequestDismiss,
|
|
187
|
+
onSheetLayout: isSheet ? onSheetLayoutReport : undefined,
|
|
188
|
+
hostOriginRequest: onWindowOffset ? windowOffsetRequest ?? 0 : 0,
|
|
189
|
+
onHostWindowOrigin: onWindowOffset ? onHostWindowOrigin : undefined,
|
|
109
190
|
testID: testID,
|
|
110
191
|
children: isSheet ? /*#__PURE__*/_jsx(View, {
|
|
111
192
|
collapsable: false,
|
|
112
193
|
onLayout: onSheetLayout,
|
|
113
194
|
style: {
|
|
114
|
-
width,
|
|
195
|
+
width: sheetContainerWidth,
|
|
196
|
+
paddingHorizontal: sheetInset,
|
|
115
197
|
height: sheet?.height,
|
|
116
198
|
maxHeight: maxSheetHeight,
|
|
117
199
|
// The host is 0x0; without this Yoga shrinks the content to 0 and
|
|
118
200
|
// a fitted sheet never learns its height.
|
|
119
201
|
flexShrink: 0
|
|
120
202
|
},
|
|
121
|
-
children: /*#__PURE__*/
|
|
203
|
+
children: hasSheetSurface ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
204
|
+
children: [sheetInset > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
205
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
206
|
+
accessible: false,
|
|
207
|
+
importantForAccessibility: "no-hide-descendants",
|
|
208
|
+
onPress: onSheetMarginPress,
|
|
209
|
+
style: [styles.sheetMarginLeft, {
|
|
210
|
+
width: sheetInset
|
|
211
|
+
}]
|
|
212
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
213
|
+
accessible: false,
|
|
214
|
+
importantForAccessibility: "no-hide-descendants",
|
|
215
|
+
onPress: onSheetMarginPress,
|
|
216
|
+
style: [styles.sheetMarginRight, {
|
|
217
|
+
width: sheetInset
|
|
218
|
+
}]
|
|
219
|
+
})]
|
|
220
|
+
}) : null, /*#__PURE__*/_jsx(View, {
|
|
221
|
+
style: [styles.sheetSurfaceTail, {
|
|
222
|
+
left: sheetInset,
|
|
223
|
+
right: sheetInset,
|
|
224
|
+
backgroundColor: sheetSurfaceBackgroundColor
|
|
225
|
+
}]
|
|
226
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
227
|
+
style: [styles.sheetSurface, {
|
|
228
|
+
backgroundColor: sheetSurfaceBackgroundColor,
|
|
229
|
+
borderTopLeftRadius: sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS,
|
|
230
|
+
borderTopRightRadius: sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS
|
|
231
|
+
}],
|
|
232
|
+
children: /*#__PURE__*/_jsx(OverlayLevelProvider, {
|
|
233
|
+
value: level,
|
|
234
|
+
children: children
|
|
235
|
+
})
|
|
236
|
+
})]
|
|
237
|
+
}) : /*#__PURE__*/_jsx(OverlayLevelProvider, {
|
|
122
238
|
value: level,
|
|
123
239
|
children: children
|
|
124
240
|
})
|
|
@@ -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","Platform","PlatformColor","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","sheetSurfaceBackgroundColor","backgroundColor","OS","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","dismissOnPanDown","onPresented","hostOriginRequest","onLayout","paddingHorizontal","flexShrink","accessible","importantForAccessibility","onPress","borderTopLeftRadius","borderTopRightRadius","value"],"sourceRoot":"../../src","sources":["OverlayView.tsx"],"mappings":";;AAAA,SAASA,WAAW,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AAAgC,QAAA,eAEFvC,IAAA,CAACL,oBAAoB;cAACoI,KAAK,EAAE/F,KAAM;cAAAO,QAAA,EAChCA;YAAQ,CACW;UAAC,CACnB,CAAC;QAAA,CACP,CAAC,gBAEHvC,IAAA,CAACL,oBAAoB;UAACoI,KAAK,EAAE/F,KAAM;UAAAO,QAAA,EAChCA;QAAQ,CACW;MACvB,CACG,CAAC,gBAEPvC,IAAA,CAACR,IAAI;QACHgH,WAAW,EAAE,KAAM;QACnBC,aAAa,EAAC,UAAU;QACxBC,KAAK,EAAE;UAAEvF,KAAK;UAAEU,MAAM;UAAE4F,UAAU,EAAE;QAAE,CAAE;QAAAlF,QAAA,eAExCvC,IAAA,CAACL,oBAAoB;UAACoI,KAAK,EAAE/F,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;AA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,EACXiD,QAAQ,GAAGwE,MAAM,CAACxE,QAAQ,CAACoG,KAAK,IAAIvK,sBAAsB,CAAC,GAAGoC,SAC/D;IACDjB,sBAAsB,EAAEgD,QAAQ,GAAG,CAAC,CAACA,QAAQ,CAACqG,cAAc,GAAG,KAAM;IACrEpJ,WAAW,EAAEyI,eAAgB;IAC7BxI,WAAW,EAAEyI,eAAgB;IAC7BxI,gBAAgB,EAAEyI,oBAAqB;IACvCxI,KAAK,EAAEiI,YAAY,KAAK,OAAO,GAAGjI,KAAK,IAAI,CAAC,CAAC,GAAGa;IAChD;IAAA;IACAZ,MAAM,EACJwI,KAAK,KAAK,MAAM,GACZnL,mBAAmB,CAAC0K,KAAK,CAAC,GAAG,IAAI,IAAII,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,EAA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A,QAAQ,IAAInC,eAAe,CAAC4K,KAAK,CAAE;IAC7CxI,aAAa,EACXiD,QAAQ,GAAG2E,MAAM,CAAC3E,QAAQ,CAACuG,KAAK,IAAI1K,sBAAsB,CAAC,GAAGoC,SAC/D;IACDjB,sBAAsB,EAAEgD,QAAQ,GAAG,CAAC,CAACA,QAAQ,CAACwG,cAAc,GAAG,KAAM;IACrEvJ,WAAW,EAAE4I,eAAgB;IAC7B3I,WAAW,EAAE4I,eAAgB;IAC7B3I,gBAAgB,EAAE4I,oBAAqB;IACvC3I,KAAK,EAAEoI,YAAY,KAAK,OAAO,GAAGpI,KAAK,IAAI,CAAC,CAAC,GAAGa;IAChD;IAAA;IACAZ,MAAM,EACJ2I,KAAK,KAAK,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;IAC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,CAAC,EAAE,UAAU,CAAC;IAClC,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3D,oEAAoE;IACpE,eAAe,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvD,WAAW,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;IAC5E,WAAW,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;IAC5E,gBAAgB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,iCAAiC,CAAC,CAAC;IACtF,mEAAmE;IACnE,aAAa,CAAC,EAAE,YAAY,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":"AAkBA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAuC5B,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,kDA4OnD"}
|
|
@@ -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":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AE,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-
|
|
3
|
+
"version": "6.7.0-20",
|
|
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,33 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
1
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Platform,
|
|
5
|
+
PlatformColor,
|
|
6
|
+
Pressable,
|
|
7
|
+
StatusBar,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
View,
|
|
10
|
+
useWindowDimensions,
|
|
11
|
+
} from 'react-native';
|
|
4
12
|
|
|
5
13
|
import NativeOverlay from './NativeOverlayNativeComponent';
|
|
6
14
|
import { OverlayLevelProvider } from './OverlayLevelContext';
|
|
7
15
|
import { isBlockingLevel } from './OverlayLevels';
|
|
16
|
+
import { resolveSheetWidth } from './sheetWidth';
|
|
8
17
|
import { useOverlayController } from './useOverlayController';
|
|
9
18
|
|
|
10
19
|
import type {
|
|
11
20
|
IOverlayRequestDismissReason,
|
|
12
21
|
IOverlayViewProps,
|
|
13
22
|
} from './OverlayViewTypes';
|
|
23
|
+
import type { ComponentRef } from 'react';
|
|
14
24
|
import type { LayoutChangeEvent, NativeSyntheticEvent } from 'react-native';
|
|
15
25
|
|
|
16
26
|
const DEFAULT_BACKDROP_COLOR = 'rgba(0, 0, 0, 0.4)';
|
|
17
27
|
const DEFAULT_SHEET_MAX_RATIO = 0.92;
|
|
28
|
+
const DEFAULT_SHEET_CORNER_RADIUS = 24;
|
|
29
|
+
// Taller than any bottom safe area; the sheet clips the rest.
|
|
30
|
+
const SHEET_SURFACE_TAIL_HEIGHT = 120;
|
|
18
31
|
|
|
19
32
|
const REQUEST_REASONS: Record<string, IOverlayRequestDismissReason> = {
|
|
20
33
|
back: 'back',
|
|
@@ -33,6 +46,16 @@ const styles = StyleSheet.create({
|
|
|
33
46
|
left: 0,
|
|
34
47
|
width: 0,
|
|
35
48
|
},
|
|
49
|
+
sheetMarginLeft: { position: 'absolute', top: 0, bottom: 0, left: 0 },
|
|
50
|
+
sheetMarginRight: { position: 'absolute', top: 0, bottom: 0, right: 0 },
|
|
51
|
+
sheetSurface: { borderCurve: 'continuous', overflow: 'hidden', flexGrow: 1 },
|
|
52
|
+
// The platform sheet extends below the content (home indicator area); the
|
|
53
|
+
// drawn surface continues into it so no backdrop shows under the content.
|
|
54
|
+
sheetSurfaceTail: {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
top: '100%',
|
|
57
|
+
height: SHEET_SURFACE_TAIL_HEIGHT,
|
|
58
|
+
},
|
|
36
59
|
});
|
|
37
60
|
|
|
38
61
|
export function OverlayView(props: IOverlayViewProps) {
|
|
@@ -47,7 +70,22 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
47
70
|
statusBarStyle,
|
|
48
71
|
children,
|
|
49
72
|
testID,
|
|
73
|
+
windowOffsetRequest,
|
|
74
|
+
onWindowOffset,
|
|
50
75
|
} = props;
|
|
76
|
+
// A plain sibling at the host's spot: its JS-measured origin shares the
|
|
77
|
+
// modal-relative space of the caller's measurements, while native reports
|
|
78
|
+
// the true one (the host's own shadow node reports the content origin).
|
|
79
|
+
const offsetProbeRef = useRef<ComponentRef<typeof View>>(null);
|
|
80
|
+
const onHostWindowOrigin = useCallback(
|
|
81
|
+
(event: NativeSyntheticEvent<{ x: number; y: number }>) => {
|
|
82
|
+
const { x: nativeX, y: nativeY } = event.nativeEvent;
|
|
83
|
+
offsetProbeRef.current?.measureInWindow((x, y) => {
|
|
84
|
+
onWindowOffset?.({ x: nativeX - x, y: nativeY - y });
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
[onWindowOffset]
|
|
88
|
+
);
|
|
51
89
|
const isSheet = presentation === 'sheet';
|
|
52
90
|
const controller = useOverlayController(props);
|
|
53
91
|
const { width, height } = useWindowDimensions();
|
|
@@ -66,6 +104,37 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
66
104
|
} = controller;
|
|
67
105
|
|
|
68
106
|
const [measuredSheetHeight, setMeasuredSheetHeight] = useState(0);
|
|
107
|
+
// iOS sizes a sheet itself (narrower than the window on wide windows), so
|
|
108
|
+
// the content follows the width native reports; Android sheets span the
|
|
109
|
+
// window and never report.
|
|
110
|
+
const [reportedSheetWidth, setReportedSheetWidth] = useState<number>();
|
|
111
|
+
const { containerWidth: sheetContainerWidth, inset: sheetInset } =
|
|
112
|
+
resolveSheetWidth({
|
|
113
|
+
windowWidth: width,
|
|
114
|
+
reportedWidth: reportedSheetWidth,
|
|
115
|
+
maxWidth: sheet?.maxWidth,
|
|
116
|
+
});
|
|
117
|
+
// `maxWidth` turns on the drawn surface even while it spans the whole sheet,
|
|
118
|
+
// so a width change never swaps who paints the background.
|
|
119
|
+
const hasSheetSurface = isSheet && sheet?.maxWidth !== undefined;
|
|
120
|
+
const sheetSurfaceBackgroundColor =
|
|
121
|
+
sheet?.backgroundColor ??
|
|
122
|
+
PlatformColor(
|
|
123
|
+
Platform.OS === 'ios'
|
|
124
|
+
? 'systemBackground'
|
|
125
|
+
: '?android:attr/colorBackground'
|
|
126
|
+
);
|
|
127
|
+
const dismissOnBackdropPress = backdrop ? !!backdrop.dismissOnPress : false;
|
|
128
|
+
const onSheetMarginPress = useCallback(() => {
|
|
129
|
+
// The margins beside a max-width surface stand in for the backdrop.
|
|
130
|
+
if (dismissOnBackdropPress) onHostRequestDismiss('backdrop');
|
|
131
|
+
}, [dismissOnBackdropPress, onHostRequestDismiss]);
|
|
132
|
+
const onSheetLayoutReport = useCallback(
|
|
133
|
+
(event: NativeSyntheticEvent<{ width: number }>) => {
|
|
134
|
+
setReportedSheetWidth(event.nativeEvent.width);
|
|
135
|
+
},
|
|
136
|
+
[]
|
|
137
|
+
);
|
|
69
138
|
const maxSheetHeight = sheet?.maxHeight ?? height * DEFAULT_SHEET_MAX_RATIO;
|
|
70
139
|
const sheetHeight = Math.min(
|
|
71
140
|
sheet?.height ?? measuredSheetHeight,
|
|
@@ -104,6 +173,14 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
104
173
|
return (
|
|
105
174
|
<>
|
|
106
175
|
{statusBar}
|
|
176
|
+
{onWindowOffset ? (
|
|
177
|
+
<View
|
|
178
|
+
ref={offsetProbeRef}
|
|
179
|
+
collapsable={false}
|
|
180
|
+
pointerEvents="none"
|
|
181
|
+
style={styles.host}
|
|
182
|
+
/>
|
|
183
|
+
) : null}
|
|
107
184
|
<NativeOverlay
|
|
108
185
|
style={styles.host}
|
|
109
186
|
// A fitted sheet presents once its content height is known.
|
|
@@ -123,12 +200,19 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
123
200
|
sheetHeight={isSheet ? sheetHeight : 0}
|
|
124
201
|
sheetCornerRadius={sheet?.cornerRadius}
|
|
125
202
|
showHandle={sheet?.showHandle}
|
|
126
|
-
|
|
203
|
+
// A max-width sheet draws its own surface, so the platform sheet
|
|
204
|
+
// stays transparent beside it.
|
|
205
|
+
sheetBackgroundColor={
|
|
206
|
+
hasSheetSurface ? 'transparent' : sheet?.backgroundColor
|
|
207
|
+
}
|
|
127
208
|
dismissOnPanDown={sheet?.dismissOnPanDown ?? true}
|
|
128
209
|
animationConfig={animationConfig}
|
|
129
210
|
onPresented={onHostPresented}
|
|
130
211
|
onDismissed={onDismissed}
|
|
131
212
|
onRequestDismiss={onRequestDismiss}
|
|
213
|
+
onSheetLayout={isSheet ? onSheetLayoutReport : undefined}
|
|
214
|
+
hostOriginRequest={onWindowOffset ? windowOffsetRequest ?? 0 : 0}
|
|
215
|
+
onHostWindowOrigin={onWindowOffset ? onHostWindowOrigin : undefined}
|
|
132
216
|
testID={testID}
|
|
133
217
|
>
|
|
134
218
|
{isSheet ? (
|
|
@@ -136,7 +220,8 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
136
220
|
collapsable={false}
|
|
137
221
|
onLayout={onSheetLayout}
|
|
138
222
|
style={{
|
|
139
|
-
width,
|
|
223
|
+
width: sheetContainerWidth,
|
|
224
|
+
paddingHorizontal: sheetInset,
|
|
140
225
|
height: sheet?.height,
|
|
141
226
|
maxHeight: maxSheetHeight,
|
|
142
227
|
// The host is 0x0; without this Yoga shrinks the content to 0 and
|
|
@@ -144,9 +229,56 @@ export function OverlayView(props: IOverlayViewProps) {
|
|
|
144
229
|
flexShrink: 0,
|
|
145
230
|
}}
|
|
146
231
|
>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
232
|
+
{hasSheetSurface ? (
|
|
233
|
+
<>
|
|
234
|
+
{sheetInset > 0 ? (
|
|
235
|
+
<>
|
|
236
|
+
<Pressable
|
|
237
|
+
accessible={false}
|
|
238
|
+
importantForAccessibility="no-hide-descendants"
|
|
239
|
+
onPress={onSheetMarginPress}
|
|
240
|
+
style={[styles.sheetMarginLeft, { width: sheetInset }]}
|
|
241
|
+
/>
|
|
242
|
+
<Pressable
|
|
243
|
+
accessible={false}
|
|
244
|
+
importantForAccessibility="no-hide-descendants"
|
|
245
|
+
onPress={onSheetMarginPress}
|
|
246
|
+
style={[styles.sheetMarginRight, { width: sheetInset }]}
|
|
247
|
+
/>
|
|
248
|
+
</>
|
|
249
|
+
) : null}
|
|
250
|
+
<View
|
|
251
|
+
style={[
|
|
252
|
+
styles.sheetSurfaceTail,
|
|
253
|
+
{
|
|
254
|
+
left: sheetInset,
|
|
255
|
+
right: sheetInset,
|
|
256
|
+
backgroundColor: sheetSurfaceBackgroundColor,
|
|
257
|
+
},
|
|
258
|
+
]}
|
|
259
|
+
/>
|
|
260
|
+
<View
|
|
261
|
+
style={[
|
|
262
|
+
styles.sheetSurface,
|
|
263
|
+
{
|
|
264
|
+
backgroundColor: sheetSurfaceBackgroundColor,
|
|
265
|
+
borderTopLeftRadius:
|
|
266
|
+
sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS,
|
|
267
|
+
borderTopRightRadius:
|
|
268
|
+
sheet?.cornerRadius ?? DEFAULT_SHEET_CORNER_RADIUS,
|
|
269
|
+
},
|
|
270
|
+
]}
|
|
271
|
+
>
|
|
272
|
+
<OverlayLevelProvider value={level}>
|
|
273
|
+
{children}
|
|
274
|
+
</OverlayLevelProvider>
|
|
275
|
+
</View>
|
|
276
|
+
</>
|
|
277
|
+
) : (
|
|
278
|
+
<OverlayLevelProvider value={level}>
|
|
279
|
+
{children}
|
|
280
|
+
</OverlayLevelProvider>
|
|
281
|
+
)}
|
|
150
282
|
</View>
|
|
151
283
|
) : (
|
|
152
284
|
<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
|
+
}
|