@onekeyfe/react-native-native-overlay 3.0.162-alpha.268
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/LICENSE +21 -0
- package/NativeOverlay.podspec +30 -0
- package/README.md +35 -0
- package/android/build.gradle +82 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayAnimation.kt +176 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEntryRootView.kt +415 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayEvents.kt +38 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayHost.kt +174 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPackage.kt +16 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPageHostView.kt +122 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayPageHostViewManager.kt +40 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayView.kt +465 -0
- package/android/src/main/java/com/onekey/nativeoverlay/NativeOverlayViewManager.kt +156 -0
- package/android/src/main/jni/CMakeLists.txt +44 -0
- package/android/src/main/jni/RNCNativeOverlay.h +19 -0
- package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayComponentDescriptor.h +12 -0
- package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayShadowNode.cpp +12 -0
- package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayShadowNode.h +41 -0
- package/common/cpp/react/renderer/components/RNCNativeOverlay/NativeOverlayState.h +40 -0
- package/docs/SPEC.md +693 -0
- package/ios/NativeOverlayAnimation.swift +160 -0
- package/ios/NativeOverlayContainerView.swift +688 -0
- package/ios/NativeOverlayKeyboard.swift +88 -0
- package/ios/NativeOverlayPageHostView.swift +98 -0
- package/ios/NativeOverlaySheetController.swift +391 -0
- package/ios/NativeOverlayWindowManager.swift +194 -0
- package/ios/RCTNativeOverlayComponentView.h +11 -0
- package/ios/RCTNativeOverlayComponentView.mm +193 -0
- package/ios/RCTNativeOverlayPageHostComponentView.h +11 -0
- package/ios/RCTNativeOverlayPageHostComponentView.mm +64 -0
- package/lib/module/NativeOverlayNativeComponent.ts +61 -0
- package/lib/module/NativeOverlayPageHostNativeComponent.ts +13 -0
- package/lib/module/OverlayErrors.js +6 -0
- package/lib/module/OverlayErrors.js.map +1 -0
- package/lib/module/OverlayLevelContext.js +27 -0
- package/lib/module/OverlayLevelContext.js.map +1 -0
- package/lib/module/OverlayLevels.js +33 -0
- package/lib/module/OverlayLevels.js.map +1 -0
- package/lib/module/OverlayPageHost.js +24 -0
- package/lib/module/OverlayPageHost.js.map +1 -0
- package/lib/module/OverlayPageHost.web.js +49 -0
- package/lib/module/OverlayPageHost.web.js.map +1 -0
- package/lib/module/OverlayPageScope.js +41 -0
- package/lib/module/OverlayPageScope.js.map +1 -0
- package/lib/module/OverlayStore.js +305 -0
- package/lib/module/OverlayStore.js.map +1 -0
- package/lib/module/OverlayView.js +141 -0
- package/lib/module/OverlayView.js.map +1 -0
- package/lib/module/OverlayView.web.js +290 -0
- package/lib/module/OverlayView.web.js.map +1 -0
- package/lib/module/OverlayViewTypes.js +4 -0
- package/lib/module/OverlayViewTypes.js.map +1 -0
- package/lib/module/animation/motionPresets.js +57 -0
- package/lib/module/animation/motionPresets.js.map +1 -0
- package/lib/module/animation/platformMotionPresets.js +4 -0
- package/lib/module/animation/platformMotionPresets.js.map +1 -0
- package/lib/module/animation/platformMotionPresets.web.js +4 -0
- package/lib/module/animation/platformMotionPresets.web.js.map +1 -0
- package/lib/module/animation/resolveAnimation.js +80 -0
- package/lib/module/animation/resolveAnimation.js.map +1 -0
- package/lib/module/animation/spring.js +69 -0
- package/lib/module/animation/spring.js.map +1 -0
- package/lib/module/animation/types.js +2 -0
- package/lib/module/animation/types.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useOverlayController.js +127 -0
- package/lib/module/useOverlayController.js.map +1 -0
- package/lib/module/useSuspendedPageOwners.js +16 -0
- package/lib/module/useSuspendedPageOwners.js.map +1 -0
- package/lib/module/web/animateTransition.js +115 -0
- package/lib/module/web/animateTransition.js.map +1 -0
- package/lib/module/web/overlayLayers.js +147 -0
- package/lib/module/web/overlayLayers.js.map +1 -0
- package/lib/module/web/useKeyboardShift.js +110 -0
- package/lib/module/web/useKeyboardShift.js.map +1 -0
- package/lib/module/web/useSheetDrag.js +126 -0
- package/lib/module/web/useSheetDrag.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeOverlayNativeComponent.d.ts +41 -0
- package/lib/typescript/src/NativeOverlayNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/NativeOverlayPageHostNativeComponent.d.ts +9 -0
- package/lib/typescript/src/NativeOverlayPageHostNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/OverlayErrors.d.ts +4 -0
- package/lib/typescript/src/OverlayErrors.d.ts.map +1 -0
- package/lib/typescript/src/OverlayLevelContext.d.ts +12 -0
- package/lib/typescript/src/OverlayLevelContext.d.ts.map +1 -0
- package/lib/typescript/src/OverlayLevels.d.ts +13 -0
- package/lib/typescript/src/OverlayLevels.d.ts.map +1 -0
- package/lib/typescript/src/OverlayPageHost.d.ts +9 -0
- package/lib/typescript/src/OverlayPageHost.d.ts.map +1 -0
- package/lib/typescript/src/OverlayPageHost.web.d.ts +11 -0
- package/lib/typescript/src/OverlayPageHost.web.d.ts.map +1 -0
- package/lib/typescript/src/OverlayPageScope.d.ts +17 -0
- package/lib/typescript/src/OverlayPageScope.d.ts.map +1 -0
- package/lib/typescript/src/OverlayStore.d.ts +72 -0
- package/lib/typescript/src/OverlayStore.d.ts.map +1 -0
- package/lib/typescript/src/OverlayView.d.ts +3 -0
- package/lib/typescript/src/OverlayView.d.ts.map +1 -0
- package/lib/typescript/src/OverlayView.web.d.ts +3 -0
- package/lib/typescript/src/OverlayView.web.d.ts.map +1 -0
- package/lib/typescript/src/OverlayViewTypes.d.ts +68 -0
- package/lib/typescript/src/OverlayViewTypes.d.ts.map +1 -0
- package/lib/typescript/src/animation/motionPresets.d.ts +13 -0
- package/lib/typescript/src/animation/motionPresets.d.ts.map +1 -0
- package/lib/typescript/src/animation/platformMotionPresets.d.ts +2 -0
- package/lib/typescript/src/animation/platformMotionPresets.d.ts.map +1 -0
- package/lib/typescript/src/animation/platformMotionPresets.web.d.ts +2 -0
- package/lib/typescript/src/animation/platformMotionPresets.web.d.ts.map +1 -0
- package/lib/typescript/src/animation/resolveAnimation.d.ts +23 -0
- package/lib/typescript/src/animation/resolveAnimation.d.ts.map +1 -0
- package/lib/typescript/src/animation/spring.d.ts +24 -0
- package/lib/typescript/src/animation/spring.d.ts.map +1 -0
- package/lib/typescript/src/animation/types.d.ts +56 -0
- package/lib/typescript/src/animation/types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +18 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +59 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/useOverlayController.d.ts +29 -0
- package/lib/typescript/src/useOverlayController.d.ts.map +1 -0
- package/lib/typescript/src/useSuspendedPageOwners.d.ts +7 -0
- package/lib/typescript/src/useSuspendedPageOwners.d.ts.map +1 -0
- package/lib/typescript/src/web/animateTransition.d.ts +18 -0
- package/lib/typescript/src/web/animateTransition.d.ts.map +1 -0
- package/lib/typescript/src/web/overlayLayers.d.ts +10 -0
- package/lib/typescript/src/web/overlayLayers.d.ts.map +1 -0
- package/lib/typescript/src/web/useKeyboardShift.d.ts +29 -0
- package/lib/typescript/src/web/useKeyboardShift.d.ts.map +1 -0
- package/lib/typescript/src/web/useSheetDrag.d.ts +13 -0
- package/lib/typescript/src/web/useSheetDrag.d.ts.map +1 -0
- package/package.json +188 -0
- package/react-native.config.js +16 -0
- package/src/NativeOverlayNativeComponent.ts +61 -0
- package/src/NativeOverlayPageHostNativeComponent.ts +13 -0
- package/src/OverlayErrors.ts +3 -0
- package/src/OverlayLevelContext.tsx +32 -0
- package/src/OverlayLevels.ts +40 -0
- package/src/OverlayPageHost.tsx +21 -0
- package/src/OverlayPageHost.web.tsx +53 -0
- package/src/OverlayPageScope.tsx +42 -0
- package/src/OverlayStore.ts +401 -0
- package/src/OverlayView.tsx +165 -0
- package/src/OverlayView.web.tsx +356 -0
- package/src/OverlayViewTypes.ts +81 -0
- package/src/animation/motionPresets.ts +52 -0
- package/src/animation/platformMotionPresets.ts +1 -0
- package/src/animation/platformMotionPresets.web.ts +1 -0
- package/src/animation/resolveAnimation.ts +103 -0
- package/src/animation/spring.ts +80 -0
- package/src/animation/types.ts +71 -0
- package/src/index.ts +55 -0
- package/src/types.ts +79 -0
- package/src/useOverlayController.ts +199 -0
- package/src/useSuspendedPageOwners.ts +26 -0
- package/src/web/animateTransition.ts +137 -0
- package/src/web/overlayLayers.ts +182 -0
- package/src/web/useKeyboardShift.ts +130 -0
- package/src/web/useSheetDrag.ts +143 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './types';
|
|
2
|
+
export { OVERLAY_LEVELS, OVERLAY_LEVEL_ORDER, OVERLAY_WEB_PAGE_Z_INDEX_BASE, OVERLAY_WEB_Z_INDEX_BASE, isBlockingLevel, } from './OverlayLevels';
|
|
3
|
+
export { OverlayRequestError } from './OverlayErrors';
|
|
4
|
+
export { OverlayStore, findStatusBarOwner, overlayStore } from './OverlayStore';
|
|
5
|
+
export type { IOverlayBackResolution, IOverlayEntryHandlers, IOverlayStoreOptions, } from './OverlayStore';
|
|
6
|
+
export * from './animation/types';
|
|
7
|
+
export { NATIVE_MOTION_PRESETS, WEB_MOTION_PRESETS, } from './animation/motionPresets';
|
|
8
|
+
export { OVERLAY_MOTION_PRESETS } from './animation/platformMotionPresets';
|
|
9
|
+
export { DEFAULT_OVERLAY_ANIMATIONS, resolveOverlayAnimation, } from './animation/resolveAnimation';
|
|
10
|
+
export type { IResolvedOverlayAnimation, IResolvedOverlayTransition, } from './animation/resolveAnimation';
|
|
11
|
+
export { springDampingRatio, springNaturalFrequency, springProgressAt, springSettleTimeMs, springToAndroidSpringForce, springToCssLinear, } from './animation/spring';
|
|
12
|
+
export { OverlayView } from './OverlayView';
|
|
13
|
+
export { useEnclosingOverlayLevel, useNestedOverlayLevel, } from './OverlayLevelContext';
|
|
14
|
+
export type { IOverlayBackdrop, IOverlayRequestDismissReason, IOverlaySheetOptions, IOverlayViewProps, } from './OverlayViewTypes';
|
|
15
|
+
export { OverlayPageHostScope, OverlayPageOwnerScope, useOverlayPageScope, } from './OverlayPageScope';
|
|
16
|
+
export type { IOverlayPageScope } from './OverlayPageScope';
|
|
17
|
+
export { OverlayPageHost } from './OverlayPageHost';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,6BAA6B,EAC7B,wBAAwB,EACxB,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChF,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,gBAAgB,EAChB,4BAA4B,EAC5B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type IOverlayScope = 'global' | 'page';
|
|
2
|
+
export type IOverlayLevel = 'modal' | 'hardware' | 'secure' | 'toast' | 'lock' | 'debug';
|
|
3
|
+
export type IOverlayStrategy = 'stack' | 'queue' | 'replace';
|
|
4
|
+
export type IOverlayPhase = 'queued' | 'active' | 'closing';
|
|
5
|
+
export type IOverlayDismissReason = 'programmatic' | 'back' | 'backdrop' | 'pan' | 'replaced' | 'page-removed' | 'system';
|
|
6
|
+
/** `light`: light content for dark overlays; `dark`: dark content. */
|
|
7
|
+
export type IOverlayStatusBarStyle = 'light' | 'dark';
|
|
8
|
+
export interface IOverlayRequest {
|
|
9
|
+
/** Stable id; generated when omitted. Re-requesting an existing id is a no-op. */
|
|
10
|
+
id?: string;
|
|
11
|
+
scope?: IOverlayScope;
|
|
12
|
+
level?: IOverlayLevel;
|
|
13
|
+
strategy?: IOverlayStrategy;
|
|
14
|
+
/** Queue ordering only: higher runs first, ties keep request order. */
|
|
15
|
+
priority?: number;
|
|
16
|
+
/**
|
|
17
|
+
* `replace` only: entries in the same lane with this key are replaced.
|
|
18
|
+
* When omitted, the topmost active entry of the lane is replaced.
|
|
19
|
+
*/
|
|
20
|
+
replaceKey?: string;
|
|
21
|
+
/** Required for `page` scope: the root-route host that renders the entry. */
|
|
22
|
+
hostKey?: string;
|
|
23
|
+
/** Required for `page` scope: the nearest page that owns the entry. */
|
|
24
|
+
ownerKey?: string;
|
|
25
|
+
/** Receives back / Escape. Defaults to true for blocking levels. */
|
|
26
|
+
dismissible?: boolean;
|
|
27
|
+
/** Blocks interaction with everything below. Defaults by level. */
|
|
28
|
+
blocking?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Status bar content while this is the topmost styled overlay; unset
|
|
31
|
+
* leaves the status bar alone.
|
|
32
|
+
*/
|
|
33
|
+
statusBarStyle?: IOverlayStatusBarStyle;
|
|
34
|
+
}
|
|
35
|
+
export interface IOverlayEntry {
|
|
36
|
+
id: string;
|
|
37
|
+
scope: IOverlayScope;
|
|
38
|
+
level: IOverlayLevel;
|
|
39
|
+
strategy: IOverlayStrategy;
|
|
40
|
+
priority: number;
|
|
41
|
+
replaceKey: string | undefined;
|
|
42
|
+
hostKey: string | undefined;
|
|
43
|
+
ownerKey: string | undefined;
|
|
44
|
+
dismissible: boolean;
|
|
45
|
+
blocking: boolean;
|
|
46
|
+
statusBarStyle: IOverlayStatusBarStyle | undefined;
|
|
47
|
+
phase: IOverlayPhase;
|
|
48
|
+
/** True while the owning page is covered or detached; page scope only. */
|
|
49
|
+
suspended: boolean;
|
|
50
|
+
dismissReason: IOverlayDismissReason | undefined;
|
|
51
|
+
/** Monotonic request order. */
|
|
52
|
+
seq: number;
|
|
53
|
+
}
|
|
54
|
+
export interface IOverlaySnapshot {
|
|
55
|
+
/** Every non-queued entry in bottom-to-top render order. */
|
|
56
|
+
entries: readonly IOverlayEntry[];
|
|
57
|
+
queued: readonly IOverlayEntry[];
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAE7D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5D,MAAM,MAAM,qBAAqB,GAC7B,cAAc,GACd,MAAM,GACN,UAAU,GACV,KAAK,GACL,UAAU,GACV,cAAc,GACd,QAAQ,CAAC;AAEb,sEAAsE;AACtE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,sBAAsB,GAAG,SAAS,CAAC;IACnD,KAAK,EAAE,aAAa,CAAC;IACrB,0EAA0E;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,qBAAqB,GAAG,SAAS,CAAC;IACjD,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;CAClC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IResolvedOverlayAnimation } from './animation/resolveAnimation';
|
|
2
|
+
import type { IOverlayRequestDismissReason, IOverlayViewProps } from './OverlayViewTypes';
|
|
3
|
+
import type { IOverlayEntry } from './types';
|
|
4
|
+
export interface IOverlayController {
|
|
5
|
+
entry: IOverlayEntry | undefined;
|
|
6
|
+
/** Render the content (entry is active or closing). */
|
|
7
|
+
mounted: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Ask the host to show the content. Page entries stay presented while
|
|
10
|
+
* suspended; the page host hides them instead (the owner may be frozen).
|
|
11
|
+
*/
|
|
12
|
+
presented: boolean;
|
|
13
|
+
scope: 'global' | 'page';
|
|
14
|
+
/** This entry's `statusBarStyle` currently drives the status bar. */
|
|
15
|
+
ownsStatusBar: boolean;
|
|
16
|
+
hostKey: string | undefined;
|
|
17
|
+
ownerKey: string | undefined;
|
|
18
|
+
animation: IResolvedOverlayAnimation;
|
|
19
|
+
onHostPresented: () => void;
|
|
20
|
+
onHostDismissed: () => void;
|
|
21
|
+
onHostRequestDismiss: (reason: IOverlayRequestDismissReason) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Bridges a declarative overlay to the shared `overlayStore`: requests an
|
|
25
|
+
* entry while `visible`, follows the store's phase, and finalizes the entry
|
|
26
|
+
* once the host reports the end of the exit animation.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useOverlayController(props: IOverlayViewProps): IOverlayController;
|
|
29
|
+
//# sourceMappingURL=useOverlayController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOverlayController.d.ts","sourceRoot":"","sources":["../../../src/useOverlayController.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,qEAAqE;IACrE,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,yBAAyB,CAAC;IACrC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,CAAC;CACtE;AAQD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,iBAAiB,GACvB,kBAAkB,CA+IpB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owners whose page overlays in `hostKey` must be hidden. The page host
|
|
3
|
+
* applies this natively: the owning page may be frozen (freezeOnBlur) and
|
|
4
|
+
* cannot re-render its own overlays.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useSuspendedPageOwners(hostKey: string): string[];
|
|
7
|
+
//# sourceMappingURL=useSuspendedPageOwners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSuspendedPageOwners.d.ts","sourceRoot":"","sources":["../../../src/useSuspendedPageOwners.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBhE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IResolvedOverlayTransition } from '../animation/resolveAnimation';
|
|
2
|
+
import type { IOverlayMotion } from '../animation/types';
|
|
3
|
+
export interface IContentExtent {
|
|
4
|
+
top: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
left: number;
|
|
7
|
+
right: number;
|
|
8
|
+
}
|
|
9
|
+
/** Union of the rendered children rects; the content wrapper is full-window. */
|
|
10
|
+
export declare function measureContentExtent(container: HTMLElement): IContentExtent;
|
|
11
|
+
/**
|
|
12
|
+
* Runs an enter (`direction: 'in'`) or exit transition on `element`. The
|
|
13
|
+
* slide distance and scale origin come from the children of `contentRoot`,
|
|
14
|
+
* because the content wrapper itself always fills the window.
|
|
15
|
+
*/
|
|
16
|
+
export declare function animateTransition(element: HTMLElement, contentRoot: HTMLElement, transition: IResolvedOverlayTransition, direction: 'in' | 'out'): Animation | undefined;
|
|
17
|
+
export declare function animateBackdrop(element: HTMLElement, motion: IOverlayMotion, direction: 'in' | 'out'): Animation;
|
|
18
|
+
//# sourceMappingURL=animateTransition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animateTransition.d.ts","sourceRoot":"","sources":["../../../../src/web/animateTransition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gFAAgF;AAChF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,cAAc,CAkB3E;AA8DD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,0BAA0B,EACtC,SAAS,EAAE,IAAI,GAAG,KAAK,GACtB,SAAS,GAAG,SAAS,CAqBvB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,IAAI,GAAG,KAAK,GACtB,SAAS,CAMX"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IOverlayRequestDismissReason } from '../OverlayViewTypes';
|
|
2
|
+
import type { IOverlayLevel } from '../types';
|
|
3
|
+
export declare const ENTRY_ATTRIBUTE = "data-onekey-overlay-entry";
|
|
4
|
+
export declare function getOverlayLayerRoot(level: IOverlayLevel): HTMLDivElement;
|
|
5
|
+
export declare function registerOverlayDismissRequester(id: string, requester: (reason: IOverlayRequestDismissReason) => void): () => void;
|
|
6
|
+
/** Re-run after entry DOM nodes mount, since the store emits before commit. */
|
|
7
|
+
export declare function scheduleOverlayInertSync(): void;
|
|
8
|
+
export declare function registerOverlayPageHost(hostKey: string, element: HTMLDivElement): () => void;
|
|
9
|
+
export declare function getOverlayPageHost(hostKey: string | undefined): HTMLDivElement | undefined;
|
|
10
|
+
//# sourceMappingURL=overlayLayers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayLayers.d.ts","sourceRoot":"","sources":["../../../../src/web/overlayLayers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,eAAO,MAAM,eAAe,8BAA8B,CAAC;AA8H3D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAQxE;AAED,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,CAAC,MAAM,EAAE,4BAA4B,KAAK,IAAI,GACxD,MAAM,IAAI,CAOZ;AAED,+EAA+E;AAC/E,wBAAgB,wBAAwB,SAEvC;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,GACtB,MAAM,IAAI,CAQZ;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,cAAc,GAAG,SAAS,CAE5B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
/** Gap between centered content and the keyboard; matches native. */
|
|
3
|
+
export declare const KEYBOARD_MARGIN = 16;
|
|
4
|
+
/**
|
|
5
|
+
* How far to lift overlay content above the software keyboard (>= 0), the
|
|
6
|
+
* same rule as iOS and Android: a sheet until its bottom clears the
|
|
7
|
+
* keyboard, other content until its bottom is `KEYBOARD_MARGIN` above it,
|
|
8
|
+
* never above the top edge. Full-window content never moves.
|
|
9
|
+
*/
|
|
10
|
+
export declare function computeKeyboardShift({ keyboardTop, contentTop, contentBottom, isSheet, safeTop, }: {
|
|
11
|
+
keyboardTop: number | undefined;
|
|
12
|
+
contentTop: number;
|
|
13
|
+
contentBottom: number;
|
|
14
|
+
isSheet: boolean;
|
|
15
|
+
safeTop?: number;
|
|
16
|
+
}): number;
|
|
17
|
+
/**
|
|
18
|
+
* Mobile browsers shrink the visual viewport for the keyboard while fixed
|
|
19
|
+
* layers keep the layout viewport; lift the entry's keyboard layer by the
|
|
20
|
+
* covered part.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useKeyboardShift({ layerRef, sheetRef, contentRef, isSheet, enabled, }: {
|
|
23
|
+
layerRef: RefObject<HTMLDivElement | null>;
|
|
24
|
+
sheetRef: RefObject<HTMLDivElement | null>;
|
|
25
|
+
contentRef: RefObject<HTMLDivElement | null>;
|
|
26
|
+
isSheet: boolean;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
}): void;
|
|
29
|
+
//# sourceMappingURL=useKeyboardShift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKeyboardShift.d.ts","sourceRoot":"","sources":["../../../../src/web/useKeyboardShift.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,qEAAqE;AACrE,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,UAAU,EACV,aAAa,EACb,OAAO,EACP,OAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAST;AA2BD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAO,EACP,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,QAoDA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Pointer-driven drag-to-dismiss for the web bottom sheet: follows the
|
|
4
|
+
* finger downward, resists upward, and dismisses past 40% of the height or
|
|
5
|
+
* on a fast flick. A drag never starts from inside scrolled content.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useSheetDrag({ sheetRef, backdropRef, enabled, onDismissByPan, }: {
|
|
8
|
+
sheetRef: RefObject<HTMLDivElement | null>;
|
|
9
|
+
backdropRef: RefObject<HTMLDivElement | null>;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
onDismissByPan: () => void;
|
|
12
|
+
}): void;
|
|
13
|
+
//# sourceMappingURL=useSheetDrag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSheetDrag.d.ts","sourceRoot":"","sources":["../../../../src/web/useSheetDrag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAsBvC;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,WAAW,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,QAwGA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@onekeyfe/react-native-native-overlay",
|
|
3
|
+
"version": "3.0.162-alpha.268",
|
|
4
|
+
"description": "Native and Web overlay hosts with ordered levels, page scope and Fabric measurement",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.ts",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"react-native": "./src/index.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"lib",
|
|
19
|
+
"android",
|
|
20
|
+
"ios",
|
|
21
|
+
"common",
|
|
22
|
+
"*.podspec",
|
|
23
|
+
"react-native.config.js",
|
|
24
|
+
"!ios/build",
|
|
25
|
+
"!android/build",
|
|
26
|
+
"!android/gradle",
|
|
27
|
+
"!android/gradlew",
|
|
28
|
+
"!android/gradlew.bat",
|
|
29
|
+
"!android/local.properties",
|
|
30
|
+
"!**/__tests__",
|
|
31
|
+
"!**/__fixtures__",
|
|
32
|
+
"!**/__mocks__",
|
|
33
|
+
"!**/.*",
|
|
34
|
+
"docs/SPEC.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
38
|
+
"prepare": "bob build",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\" && prettier --check \"src/**/*.{ts,tsx}\"",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"release": "yarn prepare && npm whoami && npm publish --access public"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"react-native",
|
|
46
|
+
"ios",
|
|
47
|
+
"android"
|
|
48
|
+
],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
52
|
+
"directory": "native-views/react-native-native-overlay"
|
|
53
|
+
},
|
|
54
|
+
"author": "@onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-views/react-native-native-overlay#readme",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
65
|
+
"@eslint/compat": "^1.3.2",
|
|
66
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
67
|
+
"@eslint/js": "^9.35.0",
|
|
68
|
+
"@react-native/babel-preset": "0.86.2",
|
|
69
|
+
"@react-native/eslint-config": "0.86.2",
|
|
70
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
71
|
+
"@types/jest": "^29.5.14",
|
|
72
|
+
"@types/react": "^19.2.0",
|
|
73
|
+
"@types/react-dom": "19.2.3",
|
|
74
|
+
"commitlint": "^19.8.1",
|
|
75
|
+
"del-cli": "^6.0.0",
|
|
76
|
+
"eslint": "^9.35.0",
|
|
77
|
+
"eslint-config-prettier": "^10.1.8",
|
|
78
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"lefthook": "^2.0.3",
|
|
81
|
+
"prettier": "^2.8.8",
|
|
82
|
+
"react": "19.2.3",
|
|
83
|
+
"react-dom": "19.2.3",
|
|
84
|
+
"react-native": "0.86.2",
|
|
85
|
+
"react-native-builder-bob": "^0.40.13",
|
|
86
|
+
"release-it": "^19.0.4",
|
|
87
|
+
"turbo": "^2.5.6",
|
|
88
|
+
"typescript": "^5.9.2"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"react": "*",
|
|
92
|
+
"react-dom": "*",
|
|
93
|
+
"react-native": "*"
|
|
94
|
+
},
|
|
95
|
+
"packageManager": "yarn@4.1.0",
|
|
96
|
+
"react-native-builder-bob": {
|
|
97
|
+
"source": "src",
|
|
98
|
+
"output": "lib",
|
|
99
|
+
"targets": [
|
|
100
|
+
[
|
|
101
|
+
"module",
|
|
102
|
+
{
|
|
103
|
+
"esm": true
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"typescript",
|
|
108
|
+
{
|
|
109
|
+
"project": "tsconfig.build.json"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"prettier": {
|
|
115
|
+
"quoteProps": "consistent",
|
|
116
|
+
"singleQuote": true,
|
|
117
|
+
"tabWidth": 2,
|
|
118
|
+
"trailingComma": "es5",
|
|
119
|
+
"useTabs": false
|
|
120
|
+
},
|
|
121
|
+
"jest": {
|
|
122
|
+
"preset": "react-native",
|
|
123
|
+
"modulePathIgnorePatterns": [
|
|
124
|
+
"<rootDir>/example/node_modules",
|
|
125
|
+
"<rootDir>/lib/"
|
|
126
|
+
],
|
|
127
|
+
"watchman": false,
|
|
128
|
+
"testMatch": [
|
|
129
|
+
"<rootDir>/src/**/__tests__/*.test.ts"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"commitlint": {
|
|
133
|
+
"extends": [
|
|
134
|
+
"@commitlint/config-conventional"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"release-it": {
|
|
138
|
+
"git": {
|
|
139
|
+
"commitMessage": "chore: release ${version}",
|
|
140
|
+
"tagName": "v${version}"
|
|
141
|
+
},
|
|
142
|
+
"npm": {
|
|
143
|
+
"publish": true
|
|
144
|
+
},
|
|
145
|
+
"github": {
|
|
146
|
+
"release": true
|
|
147
|
+
},
|
|
148
|
+
"plugins": {
|
|
149
|
+
"@release-it/conventional-changelog": {
|
|
150
|
+
"preset": {
|
|
151
|
+
"name": "angular"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"create-react-native-library": {
|
|
157
|
+
"type": "fabric-view",
|
|
158
|
+
"languages": "kotlin-swift",
|
|
159
|
+
"tools": [
|
|
160
|
+
"eslint",
|
|
161
|
+
"jest",
|
|
162
|
+
"lefthook",
|
|
163
|
+
"release-it"
|
|
164
|
+
],
|
|
165
|
+
"version": "0.56.0"
|
|
166
|
+
},
|
|
167
|
+
"source": "./src/index.ts",
|
|
168
|
+
"react-native": "./src/index.ts",
|
|
169
|
+
"peerDependenciesMeta": {
|
|
170
|
+
"react-dom": {
|
|
171
|
+
"optional": true
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"codegenConfig": {
|
|
175
|
+
"name": "RNCNativeOverlay",
|
|
176
|
+
"type": "components",
|
|
177
|
+
"jsSrcsDir": "./src",
|
|
178
|
+
"android": {
|
|
179
|
+
"javaPackageName": "com.onekey.nativeoverlay"
|
|
180
|
+
},
|
|
181
|
+
"ios": {
|
|
182
|
+
"componentProvider": {
|
|
183
|
+
"RNCNativeOverlay": "RCTNativeOverlayComponentView",
|
|
184
|
+
"RNCNativeOverlayPageHost": "RCTNativeOverlayPageHostComponentView"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
dependency: {
|
|
3
|
+
platforms: {
|
|
4
|
+
android: {
|
|
5
|
+
componentDescriptors: [
|
|
6
|
+
'RNCNativeOverlayComponentDescriptor',
|
|
7
|
+
'RNCNativeOverlayPageHostComponentDescriptor',
|
|
8
|
+
],
|
|
9
|
+
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
|
|
10
|
+
packageImportPath:
|
|
11
|
+
'import com.onekey.nativeoverlay.NativeOverlayPackage;',
|
|
12
|
+
packageInstance: 'new NativeOverlayPackage()',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { codegenNativeComponent } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
CodegenTypes,
|
|
5
|
+
ColorValue,
|
|
6
|
+
HostComponent,
|
|
7
|
+
ViewProps,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
type INativeOverlayDismissedEvent = Readonly<{
|
|
10
|
+
reason: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
type INativeOverlayRequestDismissEvent = Readonly<{
|
|
14
|
+
reason: string;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
type INativeOverlayPresentedEvent = Readonly<{
|
|
18
|
+
stackOrder: CodegenTypes.Int32;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
export interface INativeOverlayNativeProps extends ViewProps {
|
|
22
|
+
/** Present when true; play the exit animation and emit onDismissed when it turns false. */
|
|
23
|
+
visible: boolean;
|
|
24
|
+
level?: CodegenTypes.WithDefault<
|
|
25
|
+
'modal' | 'hardware' | 'secure' | 'toast' | 'lock' | 'debug',
|
|
26
|
+
'modal'
|
|
27
|
+
>;
|
|
28
|
+
presentation?: CodegenTypes.WithDefault<
|
|
29
|
+
'center' | 'toast' | 'fullscreen' | 'sheet' | 'anchored',
|
|
30
|
+
'center'
|
|
31
|
+
>;
|
|
32
|
+
scope?: CodegenTypes.WithDefault<'global' | 'page', 'global'>;
|
|
33
|
+
/** `page` scope: the `OverlayPageHost` to render in and the owning page. */
|
|
34
|
+
hostKey?: CodegenTypes.WithDefault<string, ''>;
|
|
35
|
+
ownerKey?: CodegenTypes.WithDefault<string, ''>;
|
|
36
|
+
/** Order inside the level; higher renders above. */
|
|
37
|
+
stackOrder?: CodegenTypes.WithDefault<CodegenTypes.Int32, 0>;
|
|
38
|
+
/** Swallow touches that miss the content instead of passing them through. */
|
|
39
|
+
blocking?: CodegenTypes.WithDefault<boolean, true>;
|
|
40
|
+
dismissOnBackPress?: CodegenTypes.WithDefault<boolean, true>;
|
|
41
|
+
dismissOnBackdropPress?: CodegenTypes.WithDefault<boolean, false>;
|
|
42
|
+
backdropColor?: ColorValue;
|
|
43
|
+
/** `sheet` presentation: resolved content height in points. */
|
|
44
|
+
sheetHeight?: CodegenTypes.WithDefault<CodegenTypes.Double, 0>;
|
|
45
|
+
sheetCornerRadius?: CodegenTypes.WithDefault<CodegenTypes.Double, 24>;
|
|
46
|
+
showHandle?: CodegenTypes.WithDefault<boolean, false>;
|
|
47
|
+
sheetBackgroundColor?: ColorValue;
|
|
48
|
+
dismissOnPanDown?: CodegenTypes.WithDefault<boolean, true>;
|
|
49
|
+
/** JSON of the resolved animation (`IResolvedOverlayAnimation`). */
|
|
50
|
+
animationConfig?: CodegenTypes.WithDefault<string, ''>;
|
|
51
|
+
onPresented?: CodegenTypes.DirectEventHandler<INativeOverlayPresentedEvent>;
|
|
52
|
+
onDismissed?: CodegenTypes.DirectEventHandler<INativeOverlayDismissedEvent>;
|
|
53
|
+
onRequestDismiss?: CodegenTypes.DirectEventHandler<INativeOverlayRequestDismissEvent>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// The shadow node is hand-written (common/cpp): it carries the on-screen
|
|
57
|
+
// content offset so `measure` reports where native presented the content.
|
|
58
|
+
export default codegenNativeComponent<INativeOverlayNativeProps>(
|
|
59
|
+
'RNCNativeOverlay',
|
|
60
|
+
{ interfaceOnly: true }
|
|
61
|
+
) as HostComponent<INativeOverlayNativeProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { codegenNativeComponent } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface INativeOverlayPageHostNativeProps extends ViewProps {
|
|
6
|
+
hostKey: string;
|
|
7
|
+
/** Owners whose entries are hidden, newline separated. */
|
|
8
|
+
suspendedOwners?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default codegenNativeComponent<INativeOverlayPageHostNativeProps>(
|
|
12
|
+
'RNCNativeOverlayPageHost'
|
|
13
|
+
) as HostComponent<INativeOverlayPageHostNativeProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
import { OVERLAY_LEVEL_ORDER } from './OverlayLevels';
|
|
4
|
+
|
|
5
|
+
import type { IOverlayLevel } from './types';
|
|
6
|
+
|
|
7
|
+
const OverlayLevelContext = createContext<IOverlayLevel | undefined>(undefined);
|
|
8
|
+
|
|
9
|
+
/** Provided by `OverlayView` to its content. */
|
|
10
|
+
export const OverlayLevelProvider = OverlayLevelContext.Provider;
|
|
11
|
+
|
|
12
|
+
/** The level of the overlay this component renders in, if any. */
|
|
13
|
+
export function useEnclosingOverlayLevel(): IOverlayLevel | undefined {
|
|
14
|
+
return useContext(OverlayLevelContext);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The level for an overlay opened from inside another one (a popover in a
|
|
19
|
+
* password prompt, a tooltip on the lock screen): never below the overlay it
|
|
20
|
+
* is opened from, or it would render underneath it.
|
|
21
|
+
*/
|
|
22
|
+
export function useNestedOverlayLevel(
|
|
23
|
+
minimum: IOverlayLevel = 'modal'
|
|
24
|
+
): IOverlayLevel {
|
|
25
|
+
const enclosing = useEnclosingOverlayLevel();
|
|
26
|
+
if (!enclosing) {
|
|
27
|
+
return minimum;
|
|
28
|
+
}
|
|
29
|
+
return OVERLAY_LEVEL_ORDER[enclosing] > OVERLAY_LEVEL_ORDER[minimum]
|
|
30
|
+
? enclosing
|
|
31
|
+
: minimum;
|
|
32
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IOverlayLevel } from './types';
|
|
2
|
+
|
|
3
|
+
export const OVERLAY_LEVEL_ORDER: Record<IOverlayLevel, number> = {
|
|
4
|
+
modal: 100,
|
|
5
|
+
hardware: 200,
|
|
6
|
+
secure: 300,
|
|
7
|
+
toast: 400,
|
|
8
|
+
lock: 500,
|
|
9
|
+
debug: 900,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const OVERLAY_LEVELS: readonly IOverlayLevel[] = (
|
|
13
|
+
Object.keys(OVERLAY_LEVEL_ORDER) as IOverlayLevel[]
|
|
14
|
+
).toSorted((a, b) => OVERLAY_LEVEL_ORDER[a] - OVERLAY_LEVEL_ORDER[b]);
|
|
15
|
+
|
|
16
|
+
const NON_BLOCKING_LEVELS: ReadonlySet<IOverlayLevel> = new Set([
|
|
17
|
+
'toast',
|
|
18
|
+
'debug',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export function isBlockingLevel(level: IOverlayLevel): boolean {
|
|
22
|
+
return !NON_BLOCKING_LEVELS.has(level);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Web z-index bands of the level layer roots (`document.body` children). In-page
|
|
27
|
+
* content that must rise above a level (a drag clone over a dialog) uses a
|
|
28
|
+
* value just above that level's base.
|
|
29
|
+
*/
|
|
30
|
+
export const OVERLAY_WEB_Z_INDEX_BASE: Record<IOverlayLevel, number> = {
|
|
31
|
+
modal: 100_000,
|
|
32
|
+
hardware: 120_000,
|
|
33
|
+
secure: 160_000,
|
|
34
|
+
toast: 1_000_000,
|
|
35
|
+
lock: 100_000_000,
|
|
36
|
+
debug: 100_000_005,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Page-scope entries always render below every global entry. */
|
|
40
|
+
export const OVERLAY_WEB_PAGE_Z_INDEX_BASE = 1000;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import NativeOverlayPageHost from './NativeOverlayPageHostNativeComponent';
|
|
4
|
+
import { useSuspendedPageOwners } from './useSuspendedPageOwners';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders page-scope overlays of one root route. Place it as the last child
|
|
8
|
+
* of the root-route screen, after its navigator, so page overlays cover the
|
|
9
|
+
* native header and tab bar of every page in that route.
|
|
10
|
+
*/
|
|
11
|
+
export function OverlayPageHost({ hostKey }: { hostKey: string }) {
|
|
12
|
+
const suspendedOwners = useSuspendedPageOwners(hostKey);
|
|
13
|
+
return (
|
|
14
|
+
<NativeOverlayPageHost
|
|
15
|
+
hostKey={hostKey}
|
|
16
|
+
suspendedOwners={suspendedOwners.join('\n')}
|
|
17
|
+
pointerEvents="box-none"
|
|
18
|
+
style={StyleSheet.absoluteFill}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|