@oxyhq/bloom 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/getting-started.mdx +29 -15
- package/docs/media-flight.mdx +14 -9
- package/docs/teleport.mdx +72 -0
- package/lib/commonjs/connection-status/index.js +7 -0
- package/lib/commonjs/connection-status/index.js.map +1 -1
- package/lib/commonjs/connection-status/index.web.js +7 -0
- package/lib/commonjs/connection-status/index.web.js.map +1 -1
- package/lib/commonjs/connection-status/netinfo.js +34 -0
- package/lib/commonjs/connection-status/netinfo.js.map +1 -1
- package/lib/commonjs/teleport/Portal.js +109 -0
- package/lib/commonjs/teleport/Portal.js.map +1 -0
- package/lib/commonjs/teleport/PortalHost.js +75 -0
- package/lib/commonjs/teleport/PortalHost.js.map +1 -0
- package/lib/commonjs/teleport/PortalHostView.js +40 -0
- package/lib/commonjs/teleport/PortalHostView.js.map +1 -0
- package/lib/commonjs/teleport/PortalHostView.native.js +24 -0
- package/lib/commonjs/teleport/PortalHostView.native.js.map +1 -0
- package/lib/commonjs/teleport/PortalProvider.js +57 -0
- package/lib/commonjs/teleport/PortalProvider.js.map +1 -0
- package/lib/commonjs/teleport/PortalProviderView.js +59 -0
- package/lib/commonjs/teleport/PortalProviderView.js.map +1 -0
- package/lib/commonjs/teleport/PortalProviderView.native.js +19 -0
- package/lib/commonjs/teleport/PortalProviderView.native.js.map +1 -0
- package/lib/commonjs/teleport/PortalView.js +83 -0
- package/lib/commonjs/teleport/PortalView.js.map +1 -0
- package/lib/commonjs/teleport/PortalView.native.js +14 -0
- package/lib/commonjs/teleport/PortalView.native.js.map +1 -0
- package/lib/commonjs/teleport/index.js +35 -0
- package/lib/commonjs/teleport/index.js.map +1 -0
- package/lib/commonjs/teleport/portal-manager.js +40 -0
- package/lib/commonjs/teleport/portal-manager.js.map +1 -0
- package/lib/commonjs/teleport/portal-registry.js +24 -0
- package/lib/commonjs/teleport/portal-registry.js.map +1 -0
- package/lib/commonjs/teleport/reducer.js +86 -0
- package/lib/commonjs/teleport/reducer.js.map +1 -0
- package/lib/commonjs/teleport/scroll-view-context/context.js +17 -0
- package/lib/commonjs/teleport/scroll-view-context/context.js.map +1 -0
- package/lib/commonjs/teleport/scroll-view-context/context.native.js +22 -0
- package/lib/commonjs/teleport/scroll-view-context/context.native.js.map +1 -0
- package/lib/commonjs/teleport/scroll-view-context/types.js +2 -0
- package/lib/commonjs/teleport/scroll-view-context/types.js.map +1 -0
- package/lib/commonjs/teleport/specs/PortalHostViewNativeComponent.js +17 -0
- package/lib/commonjs/teleport/specs/PortalHostViewNativeComponent.js.map +1 -0
- package/lib/commonjs/teleport/specs/PortalViewNativeComponent.js +17 -0
- package/lib/commonjs/teleport/specs/PortalViewNativeComponent.js.map +1 -0
- package/lib/commonjs/teleport/teleport-global.d.js +2 -0
- package/lib/commonjs/teleport/teleport-global.d.js.map +1 -0
- package/lib/commonjs/teleport/types.js +6 -0
- package/lib/commonjs/teleport/types.js.map +1 -0
- package/lib/commonjs/teleport/use-id.js +24 -0
- package/lib/commonjs/teleport/use-id.js.map +1 -0
- package/lib/commonjs/teleport/use-portal.js +59 -0
- package/lib/commonjs/teleport/use-portal.js.map +1 -0
- package/lib/commonjs/theme/adaptive-colors.js +30 -4
- package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
- package/lib/module/connection-status/index.js +3 -0
- package/lib/module/connection-status/index.js.map +1 -1
- package/lib/module/connection-status/index.web.js +3 -0
- package/lib/module/connection-status/index.web.js.map +1 -1
- package/lib/module/connection-status/netinfo.js +33 -0
- package/lib/module/connection-status/netinfo.js.map +1 -1
- package/lib/module/teleport/Portal.js +103 -0
- package/lib/module/teleport/Portal.js.map +1 -0
- package/lib/module/teleport/PortalHost.js +71 -0
- package/lib/module/teleport/PortalHost.js.map +1 -0
- package/lib/module/teleport/PortalHostView.js +35 -0
- package/lib/module/teleport/PortalHostView.js.map +1 -0
- package/lib/module/teleport/PortalHostView.native.js +18 -0
- package/lib/module/teleport/PortalHostView.native.js.map +1 -0
- package/lib/module/teleport/PortalProvider.js +51 -0
- package/lib/module/teleport/PortalProvider.js.map +1 -0
- package/lib/module/teleport/PortalProviderView.js +54 -0
- package/lib/module/teleport/PortalProviderView.js.map +1 -0
- package/lib/module/teleport/PortalProviderView.native.js +15 -0
- package/lib/module/teleport/PortalProviderView.native.js.map +1 -0
- package/lib/module/teleport/PortalView.js +79 -0
- package/lib/module/teleport/PortalView.js.map +1 -0
- package/lib/module/teleport/PortalView.native.js +10 -0
- package/lib/module/teleport/PortalView.native.js.map +1 -0
- package/lib/module/teleport/index.js +30 -0
- package/lib/module/teleport/index.js.map +1 -0
- package/lib/module/teleport/portal-manager.js +33 -0
- package/lib/module/teleport/portal-manager.js.map +1 -0
- package/lib/module/teleport/portal-registry.js +18 -0
- package/lib/module/teleport/portal-registry.js.map +1 -0
- package/lib/module/teleport/reducer.js +81 -0
- package/lib/module/teleport/reducer.js.map +1 -0
- package/lib/module/teleport/scroll-view-context/context.js +12 -0
- package/lib/module/teleport/scroll-view-context/context.js.map +1 -0
- package/lib/module/teleport/scroll-view-context/context.native.js +18 -0
- package/lib/module/teleport/scroll-view-context/context.native.js.map +1 -0
- package/lib/module/teleport/scroll-view-context/types.js +2 -0
- package/lib/module/teleport/scroll-view-context/types.js.map +1 -0
- package/lib/module/teleport/specs/PortalHostViewNativeComponent.js +13 -0
- package/lib/module/teleport/specs/PortalHostViewNativeComponent.js.map +1 -0
- package/lib/module/teleport/specs/PortalViewNativeComponent.js +13 -0
- package/lib/module/teleport/specs/PortalViewNativeComponent.js.map +1 -0
- package/lib/module/teleport/teleport-global.d.js +2 -0
- package/lib/module/teleport/teleport-global.d.js.map +1 -0
- package/lib/module/teleport/types.js +4 -0
- package/lib/module/teleport/types.js.map +1 -0
- package/lib/module/teleport/use-id.js +19 -0
- package/lib/module/teleport/use-id.js.map +1 -0
- package/lib/module/teleport/use-portal.js +55 -0
- package/lib/module/teleport/use-portal.js.map +1 -0
- package/lib/module/theme/adaptive-colors.js +30 -4
- package/lib/module/theme/adaptive-colors.js.map +1 -1
- package/lib/typescript/commonjs/connection-status/index.d.ts +1 -0
- package/lib/typescript/commonjs/connection-status/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-status/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/connection-status/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/connection-status/netinfo.d.ts +25 -0
- package/lib/typescript/commonjs/connection-status/netinfo.d.ts.map +1 -1
- package/lib/typescript/commonjs/teleport/Portal.d.ts +48 -0
- package/lib/typescript/commonjs/teleport/Portal.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalHost.d.ts +25 -0
- package/lib/typescript/commonjs/teleport/PortalHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalHostView.d.ts +5 -0
- package/lib/typescript/commonjs/teleport/PortalHostView.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalHostView.native.d.ts +4 -0
- package/lib/typescript/commonjs/teleport/PortalHostView.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalProvider.d.ts +23 -0
- package/lib/typescript/commonjs/teleport/PortalProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalProviderView.d.ts +3 -0
- package/lib/typescript/commonjs/teleport/PortalProviderView.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalProviderView.native.d.ts +9 -0
- package/lib/typescript/commonjs/teleport/PortalProviderView.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalView.d.ts +9 -0
- package/lib/typescript/commonjs/teleport/PortalView.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/PortalView.native.d.ts +8 -0
- package/lib/typescript/commonjs/teleport/PortalView.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/index.d.ts +29 -0
- package/lib/typescript/commonjs/teleport/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/portal-manager.d.ts +16 -0
- package/lib/typescript/commonjs/teleport/portal-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/portal-registry.d.ts +10 -0
- package/lib/typescript/commonjs/teleport/portal-registry.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/reducer.d.ts +40 -0
- package/lib/typescript/commonjs/teleport/reducer.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/scroll-view-context/context.d.ts +4 -0
- package/lib/typescript/commonjs/teleport/scroll-view-context/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/scroll-view-context/context.native.d.ts +13 -0
- package/lib/typescript/commonjs/teleport/scroll-view-context/context.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/scroll-view-context/types.d.ts +10 -0
- package/lib/typescript/commonjs/teleport/scroll-view-context/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/specs/PortalHostViewNativeComponent.d.ts +13 -0
- package/lib/typescript/commonjs/teleport/specs/PortalHostViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/specs/PortalViewNativeComponent.d.ts +14 -0
- package/lib/typescript/commonjs/teleport/specs/PortalViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/types.d.ts +22 -0
- package/lib/typescript/commonjs/teleport/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/use-id.d.ts +2 -0
- package/lib/typescript/commonjs/teleport/use-id.d.ts.map +1 -0
- package/lib/typescript/commonjs/teleport/use-portal.d.ts +35 -0
- package/lib/typescript/commonjs/teleport/use-portal.d.ts.map +1 -0
- package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/index.d.ts +1 -0
- package/lib/typescript/module/connection-status/index.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/index.web.d.ts +1 -0
- package/lib/typescript/module/connection-status/index.web.d.ts.map +1 -1
- package/lib/typescript/module/connection-status/netinfo.d.ts +25 -0
- package/lib/typescript/module/connection-status/netinfo.d.ts.map +1 -1
- package/lib/typescript/module/teleport/Portal.d.ts +48 -0
- package/lib/typescript/module/teleport/Portal.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalHost.d.ts +25 -0
- package/lib/typescript/module/teleport/PortalHost.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalHostView.d.ts +5 -0
- package/lib/typescript/module/teleport/PortalHostView.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalHostView.native.d.ts +4 -0
- package/lib/typescript/module/teleport/PortalHostView.native.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalProvider.d.ts +23 -0
- package/lib/typescript/module/teleport/PortalProvider.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalProviderView.d.ts +3 -0
- package/lib/typescript/module/teleport/PortalProviderView.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalProviderView.native.d.ts +9 -0
- package/lib/typescript/module/teleport/PortalProviderView.native.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalView.d.ts +9 -0
- package/lib/typescript/module/teleport/PortalView.d.ts.map +1 -0
- package/lib/typescript/module/teleport/PortalView.native.d.ts +8 -0
- package/lib/typescript/module/teleport/PortalView.native.d.ts.map +1 -0
- package/lib/typescript/module/teleport/index.d.ts +29 -0
- package/lib/typescript/module/teleport/index.d.ts.map +1 -0
- package/lib/typescript/module/teleport/portal-manager.d.ts +16 -0
- package/lib/typescript/module/teleport/portal-manager.d.ts.map +1 -0
- package/lib/typescript/module/teleport/portal-registry.d.ts +10 -0
- package/lib/typescript/module/teleport/portal-registry.d.ts.map +1 -0
- package/lib/typescript/module/teleport/reducer.d.ts +40 -0
- package/lib/typescript/module/teleport/reducer.d.ts.map +1 -0
- package/lib/typescript/module/teleport/scroll-view-context/context.d.ts +4 -0
- package/lib/typescript/module/teleport/scroll-view-context/context.d.ts.map +1 -0
- package/lib/typescript/module/teleport/scroll-view-context/context.native.d.ts +13 -0
- package/lib/typescript/module/teleport/scroll-view-context/context.native.d.ts.map +1 -0
- package/lib/typescript/module/teleport/scroll-view-context/types.d.ts +10 -0
- package/lib/typescript/module/teleport/scroll-view-context/types.d.ts.map +1 -0
- package/lib/typescript/module/teleport/specs/PortalHostViewNativeComponent.d.ts +13 -0
- package/lib/typescript/module/teleport/specs/PortalHostViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/teleport/specs/PortalViewNativeComponent.d.ts +14 -0
- package/lib/typescript/module/teleport/specs/PortalViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/teleport/types.d.ts +22 -0
- package/lib/typescript/module/teleport/types.d.ts.map +1 -0
- package/lib/typescript/module/teleport/use-id.d.ts +2 -0
- package/lib/typescript/module/teleport/use-id.d.ts.map +1 -0
- package/lib/typescript/module/teleport/use-portal.d.ts +35 -0
- package/lib/typescript/module/teleport/use-portal.d.ts.map +1 -0
- package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
- package/package.json +15 -1
- package/src/connection-status/index.ts +3 -0
- package/src/connection-status/index.web.ts +3 -0
- package/src/connection-status/netinfo.ts +33 -0
- package/src/teleport/Portal.tsx +97 -0
- package/src/teleport/PortalHost.tsx +61 -0
- package/src/teleport/PortalHostView.native.tsx +14 -0
- package/src/teleport/PortalHostView.tsx +30 -0
- package/src/teleport/PortalProvider.tsx +51 -0
- package/src/teleport/PortalProviderView.native.tsx +11 -0
- package/src/teleport/PortalProviderView.tsx +67 -0
- package/src/teleport/PortalView.native.tsx +7 -0
- package/src/teleport/PortalView.tsx +94 -0
- package/src/teleport/index.ts +32 -0
- package/src/teleport/portal-manager.tsx +48 -0
- package/src/teleport/portal-registry.ts +27 -0
- package/src/teleport/reducer.ts +94 -0
- package/src/teleport/scroll-view-context/context.native.ts +19 -0
- package/src/teleport/scroll-view-context/context.ts +12 -0
- package/src/teleport/scroll-view-context/types.ts +7 -0
- package/src/teleport/specs/PortalHostViewNativeComponent.ts +15 -0
- package/src/teleport/specs/PortalViewNativeComponent.ts +16 -0
- package/src/teleport/teleport-global.d.ts +11 -0
- package/src/teleport/types.ts +22 -0
- package/src/teleport/use-id.ts +18 -0
- package/src/teleport/use-portal.ts +47 -0
- package/src/theme/adaptive-colors.ts +37 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/views/PortalProvider/index.native.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: nothing — byte-for-byte, only its path.
|
|
6
|
+
*/
|
|
7
|
+
import type { PortalProviderProps } from "./types";
|
|
8
|
+
export default function PortalProvider({ children }: PortalProviderProps): import("react").ReactNode;
|
|
9
|
+
//# sourceMappingURL=PortalProviderView.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalProviderView.native.d.ts","sourceRoot":"","sources":["../../../../src/teleport/PortalProviderView.native.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,6BAEvE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/views/Portal/index.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
import type { PortalProps } from "./types";
|
|
8
|
+
export default function Portal({ hostName, children, style }: PortalProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=PortalView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalView.d.ts","sourceRoot":"","sources":["../../../../src/teleport/PortalView.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAsB3C,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,WAAW,2CAsDxE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/views/Portal/index.native.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
export { default } from "./specs/PortalViewNativeComponent";
|
|
8
|
+
//# sourceMappingURL=PortalView.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalView.native.d.ts","sourceRoot":"","sources":["../../../../src/teleport/PortalView.native.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-native-teleport, vendored.
|
|
3
|
+
*
|
|
4
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/index.ts`. MIT, Copyright (c)
|
|
5
|
+
* 2025 Kiryl Ziusko; the full licence is in `NOTICE` at the repository root and
|
|
6
|
+
* every file in this directory names the file it came from.
|
|
7
|
+
*
|
|
8
|
+
* It is here rather than as a dependency because Bloom needs its NATIVE
|
|
9
|
+
* re-parenting — moving one platform view between hosts instead of mounting a
|
|
10
|
+
* second one — and that arrives as Fabric components, not as JavaScript.
|
|
11
|
+
*
|
|
12
|
+
* WHAT IS DIFFERENT FROM UPSTREAM, and it is not their code: **Bloom mounts
|
|
13
|
+
* these portals from its ROOT LAYER, never from the origin screen.** Their own
|
|
14
|
+
* recipe mounts the `<Portal>` inside the screen the media starts on, which is
|
|
15
|
+
* correct for a navigator that keeps that screen alive — and measured against
|
|
16
|
+
* expo-router on web, where the origin route unmounts on the URL change, it
|
|
17
|
+
* takes the media with it (`count 1 -> 0 -> 0`). The portal is not what fails
|
|
18
|
+
* there; the ownership is. Same piece, mounted where it does not die.
|
|
19
|
+
*
|
|
20
|
+
* Changed: import paths only, for this flat directory. Their file layout uses
|
|
21
|
+
* `index.tsx` per component, which Bloom's family-layout gate reserves for pure
|
|
22
|
+
* barrels, so each one is named after what it exports.
|
|
23
|
+
*/
|
|
24
|
+
export { default as PortalHost } from './PortalHost';
|
|
25
|
+
export { default as Portal } from './Portal';
|
|
26
|
+
export { default as PortalProvider } from './PortalProvider';
|
|
27
|
+
export { default as usePortal } from './use-portal';
|
|
28
|
+
export type { PortalHostProps, PortalProps, PortalProviderProps, } from './types';
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/teleport/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EACV,eAAe,EACf,WAAW,EACX,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/contexts/PortalManager.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from "react";
|
|
8
|
+
import { type Action, type PortalState } from "./reducer";
|
|
9
|
+
export declare const PortalManagerProvider: ({ children, }: {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const usePortalManagerContext: () => {
|
|
13
|
+
state: PortalState;
|
|
14
|
+
dispatch: React.Dispatch<Action>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=portal-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-manager.d.ts","sourceRoot":"","sources":["../../../../src/teleport/portal-manager.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AAMnB,eAAO,MAAM,qBAAqB,GAAI,eAEnC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,4CASA,CAAC;AAEF,eAAO,MAAM,uBAAuB;WAlBzB,WAAW;cAAY,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;CA0BvD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type PortalRegistryContextType = {
|
|
2
|
+
registerHost: (name: string, node: HTMLElement | null) => void;
|
|
3
|
+
getHost: (name: string) => HTMLElement | null;
|
|
4
|
+
registerPendingPortal: (name: string, callback: () => void) => void;
|
|
5
|
+
unregisterPendingPortal: (name: string, callback: () => void) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const PortalRegistryContext: import("react").Context<PortalRegistryContextType | null>;
|
|
8
|
+
export declare function usePortalRegistryContext(): PortalRegistryContextType;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=portal-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-registry.d.ts","sourceRoot":"","sources":["../../../../src/teleport/portal-registry.ts"],"names":[],"mappings":"AAQA,KAAK,yBAAyB,GAAG;IAC/B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/D,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,GAAG,IAAI,CAAC;IAC9C,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACpE,uBAAuB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACvE,CAAC;AAEF,eAAO,MAAM,qBAAqB,2DACqB,CAAC;AAExD,wBAAgB,wBAAwB,8BAQvC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/state/reducer.ts`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: nothing — byte-for-byte, only its path.
|
|
6
|
+
*/
|
|
7
|
+
import type { ScrollViewContextValue } from "./scroll-view-context/types";
|
|
8
|
+
export type PortalState = {
|
|
9
|
+
removed: Record<string, Record<string, Record<string, boolean>>>;
|
|
10
|
+
hosts: Record<string, number>;
|
|
11
|
+
hostScrollViewContexts: Record<string, ScrollViewContextValue | undefined>;
|
|
12
|
+
};
|
|
13
|
+
export type Action = {
|
|
14
|
+
type: "REMOVE_PORTAL";
|
|
15
|
+
hostName: string;
|
|
16
|
+
name: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: "CLEAR_REMOVED_ON_UNMOUNT";
|
|
19
|
+
hostName: string;
|
|
20
|
+
name: string;
|
|
21
|
+
instanceId: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "REGISTER_PORTAL";
|
|
24
|
+
hostName: string;
|
|
25
|
+
name: string;
|
|
26
|
+
instanceId: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "REGISTER_HOST";
|
|
29
|
+
hostName: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "UNREGISTER_HOST";
|
|
32
|
+
hostName: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: "SET_HOST_SCROLL_VIEW_CONTEXT";
|
|
35
|
+
hostName: string;
|
|
36
|
+
value: ScrollViewContextValue;
|
|
37
|
+
};
|
|
38
|
+
export declare const initialState: PortalState;
|
|
39
|
+
export declare const reducer: (state: PortalState, action: Action) => PortalState;
|
|
40
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/teleport/reducer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,CAAC,CAAC;CAC5E,CAAC;AAEF,MAAM,MAAM,MAAM,GACd;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzD;IACE,IAAI,EAAE,0BAA0B,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,GACD;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,GACD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC7C;IACE,IAAI,EAAE,8BAA8B,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,sBAAsB,CAAC;CAC/B,CAAC;AAEN,eAAO,MAAM,YAAY,EAAE,WAI1B,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,WAAW,EAAE,QAAQ,MAAM,KAAG,WAmD5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/teleport/scroll-view-context/context.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,iBAAiB,iDAA8C,CAAC;AAEtE,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/contexts/ScrollViewContext/index.native.ts`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths, and `ScrollView.Context` is reached through a cast
|
|
6
|
+
* because Bloom does not compile with their `react-native-strict-api` condition,
|
|
7
|
+
* which is the only place that property is declared.
|
|
8
|
+
*/
|
|
9
|
+
import type { Context } from "react";
|
|
10
|
+
import type { ScrollViewContextValue } from "./types";
|
|
11
|
+
declare const ScrollViewContext: Context<ScrollViewContextValue>;
|
|
12
|
+
export default ScrollViewContext;
|
|
13
|
+
//# sourceMappingURL=context.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.native.d.ts","sourceRoot":"","sources":["../../../../../src/teleport/scroll-view-context/context.native.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAKtD,QAAA,MAAM,iBAAiB,iCACb,CAAC;AAEX,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/contexts/ScrollViewContext/types.ts`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: nothing — byte-for-byte, only its path.
|
|
6
|
+
*/
|
|
7
|
+
export type ScrollViewContextValue = {
|
|
8
|
+
horizontal: boolean;
|
|
9
|
+
} | null;
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/teleport/scroll-view-context/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/specs/PortalHostViewNativeComponent.ts`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: nothing — byte-for-byte, only its path.
|
|
6
|
+
*/
|
|
7
|
+
import { type ViewProps } from "react-native";
|
|
8
|
+
interface NativeProps extends ViewProps {
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=PortalHostViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalHostViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../../src/teleport/specs/PortalHostViewNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;;AAED,wBAEG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/specs/PortalViewNativeComponent.ts`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: nothing — byte-for-byte, only its path.
|
|
6
|
+
*/
|
|
7
|
+
import { type ViewProps } from "react-native";
|
|
8
|
+
interface NativeProps extends ViewProps {
|
|
9
|
+
name?: string;
|
|
10
|
+
hostName?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=PortalViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../../src/teleport/specs/PortalViewNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;;AAED,wBAEG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/types/index.ts`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: nothing — byte-for-byte, only its path.
|
|
6
|
+
*/
|
|
7
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
8
|
+
export type PortalProviderProps = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type PortalHostProps = {
|
|
12
|
+
name: string;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export type PortalProps = {
|
|
17
|
+
name?: string;
|
|
18
|
+
hostName?: string;
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/teleport/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AACF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-id.d.ts","sourceRoot":"","sources":["../../../../src/teleport/use-id.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,MAAM,SAAQ,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `usePortal` hook allows you to manage portals in imperative way.
|
|
3
|
+
*
|
|
4
|
+
* @category hooks
|
|
5
|
+
* @param `hostName` - `name` of the `<PortalHost />` component
|
|
6
|
+
* @returns an object that helps to manipulate portals
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { usePortal } from "react-native-teleport";
|
|
10
|
+
* export default function App() {
|
|
11
|
+
* const { removePortal, isHostAvailable } = usePortal("root");
|
|
12
|
+
* return (
|
|
13
|
+
* <View style={{ flex: 1 }}>
|
|
14
|
+
* <Text>{isHostAvailable ? "Host is available" : "Host is not available"}</Text>
|
|
15
|
+
* <Button title="Remove" onPress={() => removePortal("portal")} />
|
|
16
|
+
* </View>
|
|
17
|
+
* );
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export default function usePortal(hostName?: string): {
|
|
22
|
+
/**
|
|
23
|
+
* Whether a `<PortalHost />` with the given `hostName` is currently mounted.
|
|
24
|
+
*/
|
|
25
|
+
isHostAvailable: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Remove portal from host container. Subsequent re-renders will not restore portal,
|
|
28
|
+
* but if you mount a new portal with the same name it will be shown (i. e. hook doesn't
|
|
29
|
+
* prevent new portal from being added).
|
|
30
|
+
*
|
|
31
|
+
* @param name - `name` of `<Portal />` component.
|
|
32
|
+
*/
|
|
33
|
+
removePortal: (name: string) => void;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=use-portal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-portal.d.ts","sourceRoot":"","sources":["../../../../src/teleport/use-portal.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,QAAQ,GAAE,MAAe;IAIvD;;OAEG;;IAEH;;;;;;OAMG;yBACkB,MAAM;EAG9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive-colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/adaptive-colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,yBAAyB,GACzB,YAAY,GACZ,sBAAsB,CACzB,CAAC;
|
|
1
|
+
{"version":3,"file":"adaptive-colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/adaptive-colors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,WAAW,EACT,eAAe,GACf,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,eAAe,GACf,yBAAyB,GACzB,YAAY,GACZ,sBAAsB,CACzB,CAAC;AA+HF,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAIzD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/bloom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -624,6 +624,20 @@
|
|
|
624
624
|
"default": "./lib/commonjs/media-flight/index.js"
|
|
625
625
|
}
|
|
626
626
|
},
|
|
627
|
+
"./teleport": {
|
|
628
|
+
"react-native": {
|
|
629
|
+
"types": "./lib/typescript/module/teleport/index.d.ts",
|
|
630
|
+
"default": "./src/teleport/index.ts"
|
|
631
|
+
},
|
|
632
|
+
"import": {
|
|
633
|
+
"types": "./lib/typescript/module/teleport/index.d.ts",
|
|
634
|
+
"default": "./lib/module/teleport/index.js"
|
|
635
|
+
},
|
|
636
|
+
"require": {
|
|
637
|
+
"types": "./lib/typescript/commonjs/teleport/index.d.ts",
|
|
638
|
+
"default": "./lib/commonjs/teleport/index.js"
|
|
639
|
+
}
|
|
640
|
+
},
|
|
627
641
|
"./pressable-scale": {
|
|
628
642
|
"react-native": {
|
|
629
643
|
"types": "./lib/typescript/module/pressable-scale/index.d.ts",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export type { ConnectionStatusToastsProps } from './shared';
|
|
2
|
+
// The hatch a consumer needs off Metro, where the optional `require` does not
|
|
3
|
+
// deliver the peer even when it is installed. See `netinfo.ts`.
|
|
4
|
+
export { provideNetInfo, type NetInfoLike } from './netinfo';
|
|
2
5
|
export {
|
|
3
6
|
ConnectionStatusToasts,
|
|
4
7
|
} from './ConnectionStatusToasts';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export type { ConnectionStatusToastsProps } from './shared';
|
|
2
|
+
// The hatch a consumer needs off Metro, where the optional `require` does not
|
|
3
|
+
// deliver the peer even when it is installed. See `netinfo.ts`.
|
|
4
|
+
export { provideNetInfo, type NetInfoLike } from './netinfo';
|
|
2
5
|
export {
|
|
3
6
|
ConnectionStatusToasts,
|
|
4
7
|
} from './ConnectionStatusToasts.web';
|
|
@@ -69,12 +69,45 @@ export interface NetInfoLike {
|
|
|
69
69
|
|
|
70
70
|
/** `undefined` until the first load attempt, then the module or `null`. */
|
|
71
71
|
let netInfoModule: NetInfoLike | null | undefined;
|
|
72
|
+
/** Handed in by a consumer, which is the only thing that works in an ESM bundle. */
|
|
73
|
+
let providedModule: NetInfoLike | null = null;
|
|
72
74
|
/** Why the load failed, quoted verbatim in the dev warning. */
|
|
73
75
|
let unavailableReason = '';
|
|
74
76
|
let hasWarned = false;
|
|
75
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Hand Bloom the netinfo module, from a consumer that has it.
|
|
80
|
+
*
|
|
81
|
+
* THIS IS NOT A TEST HOOK. It is the only mechanism that works in an ESM
|
|
82
|
+
* bundle: the consumer, who knows it has the peer and which entry of it its own
|
|
83
|
+
* bundler resolved, hands the module in.
|
|
84
|
+
*
|
|
85
|
+
* The `require` below cannot be relied on off Metro, and the reason is worth
|
|
86
|
+
* knowing because the symptom is identical while the cause is not:
|
|
87
|
+
*
|
|
88
|
+
* - Rollup / Vite ESM output: `require` is undefined, the guard catches it,
|
|
89
|
+
* and the boundary degrades.
|
|
90
|
+
* - esbuild ESM output: `require` EXISTS as a shim that throws
|
|
91
|
+
* (`Dynamic require of "…" is not supported`), so the guard PASSES and the
|
|
92
|
+
* call throws inside the try. Measured with the peer installed on disk:
|
|
93
|
+
* `platform=node` and `platform=browser` both degraded.
|
|
94
|
+
*
|
|
95
|
+
* So a fix aimed at the `typeof require` check would have changed nothing under
|
|
96
|
+
* esbuild. And there is no synchronous, bundler-agnostic alternative: `import()`
|
|
97
|
+
* is asynchronous AND resolved at build time, so an absent package fails the
|
|
98
|
+
* BUILD — which is what this boundary exists to prevent.
|
|
99
|
+
*
|
|
100
|
+
* Metro is unaffected either way and needs no binding.
|
|
101
|
+
*/
|
|
102
|
+
export function provideNetInfo(module: NetInfoLike | null): void {
|
|
103
|
+
providedModule = module;
|
|
104
|
+
netInfoModule = undefined;
|
|
105
|
+
hasWarned = false;
|
|
106
|
+
}
|
|
107
|
+
|
|
76
108
|
/** The netinfo module, or `null` when the optional peer is not installed. */
|
|
77
109
|
export function loadNetInfo(): NetInfoLike | null {
|
|
110
|
+
if (providedModule !== null) return providedModule;
|
|
78
111
|
if (netInfoModule !== undefined) return netInfoModule;
|
|
79
112
|
netInfoModule = null;
|
|
80
113
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/components/Portal.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
import { useContext, useEffect } from "react";
|
|
8
|
+
import { usePortalManagerContext } from "./portal-manager";
|
|
9
|
+
import ScrollViewContext from "./scroll-view-context/context";
|
|
10
|
+
import PortalView from "./PortalView";
|
|
11
|
+
import useId from "./use-id";
|
|
12
|
+
import type { PortalProps } from "./types";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Portal helps you to render a component in a different place in the view hierarchy.
|
|
16
|
+
* This is useful when you need a view to visually “break out” of its parent container (for example: modals, toasts, floating UI, popovers).
|
|
17
|
+
*
|
|
18
|
+
* @category components
|
|
19
|
+
* @param hostName - The `name` of the `PortalHost`. It's used to identify the host where the content should be rendered.
|
|
20
|
+
* @param name - The name of the portal. It's used to identify the portal.
|
|
21
|
+
* @param children - The content that should be rendered in the portal.
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { useState } from "react";
|
|
25
|
+
* import { View, StyleSheet, Button } from "react-native";
|
|
26
|
+
* import { Portal } from "react-native-teleport";
|
|
27
|
+
* export default function InstantRootExample() {
|
|
28
|
+
* const [shouldBeTeleported, setTeleported] = useState(true);
|
|
29
|
+
* return (
|
|
30
|
+
* <View style={styles.container}>
|
|
31
|
+
* {shouldBeTeleported && (
|
|
32
|
+
* <Portal hostName={"overlay"}>
|
|
33
|
+
* <View style={styles.box} />
|
|
34
|
+
* </Portal>
|
|
35
|
+
* )}
|
|
36
|
+
* <Button
|
|
37
|
+
* title={shouldBeTeleported ? "Hide" : "Show"}
|
|
38
|
+
* onPress={() => setTeleported((t) => !t)}
|
|
39
|
+
* />
|
|
40
|
+
* </View>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* const styles = StyleSheet.create({
|
|
44
|
+
* container: {
|
|
45
|
+
* flex: 1,
|
|
46
|
+
* alignItems: "center",
|
|
47
|
+
* justifyContent: "center",
|
|
48
|
+
* },
|
|
49
|
+
* box: {
|
|
50
|
+
* width: 160,
|
|
51
|
+
* height: 160,
|
|
52
|
+
* marginVertical: 20,
|
|
53
|
+
* backgroundColor: "blue",
|
|
54
|
+
* },
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
const PortalComponent = ({ hostName, name, style, children }: PortalProps) => {
|
|
59
|
+
const sourceScrollViewContext = useContext(ScrollViewContext);
|
|
60
|
+
const { state, dispatch } = usePortalManagerContext();
|
|
61
|
+
const instanceId = useId();
|
|
62
|
+
|
|
63
|
+
const scrollViewContext =
|
|
64
|
+
hostName && state.hosts[hostName]
|
|
65
|
+
? (state.hostScrollViewContexts[hostName] ?? null)
|
|
66
|
+
: sourceScrollViewContext;
|
|
67
|
+
|
|
68
|
+
const isRemoved =
|
|
69
|
+
hostName && name ? state.removed[hostName]?.[name]?.[instanceId] : false;
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!hostName || !name) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
dispatch({ type: "REGISTER_PORTAL", hostName, name, instanceId });
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
dispatch({
|
|
80
|
+
type: "CLEAR_REMOVED_ON_UNMOUNT",
|
|
81
|
+
hostName,
|
|
82
|
+
name,
|
|
83
|
+
instanceId,
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}, [dispatch, hostName, name, instanceId]);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<ScrollViewContext.Provider value={scrollViewContext}>
|
|
90
|
+
<PortalView hostName={hostName} name={name} style={style}>
|
|
91
|
+
{isRemoved ? null : children}
|
|
92
|
+
</PortalView>
|
|
93
|
+
</ScrollViewContext.Provider>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default PortalComponent;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/components/PortalHost.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
import { useContext, useEffect } from "react";
|
|
8
|
+
import { usePortalManagerContext } from "./portal-manager";
|
|
9
|
+
import ScrollViewContext from "./scroll-view-context/context";
|
|
10
|
+
import type { PortalHostProps } from "./types";
|
|
11
|
+
import PortalHost from "./PortalHostView";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* PortalHost is a component that acts as an anchor for the portals.
|
|
15
|
+
* You can define multiple portal hosts in your app and use them to render different portals.
|
|
16
|
+
* Each portal host has a unique name that you can use to identify a necessary one among the others.
|
|
17
|
+
*
|
|
18
|
+
* @category components
|
|
19
|
+
* @param name - The name of the portal host. It's used by `<Portal />` component to identify the host.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { StyleSheet, View } from "react-native";
|
|
24
|
+
* import { PortalHost, PortalProvider } from "react-native-teleport";
|
|
25
|
+
* export default function App() {
|
|
26
|
+
* return (
|
|
27
|
+
* <PortalProvider>
|
|
28
|
+
* <PortalHost style={StyleSheet.absoluteFillObject} name="overlay" />
|
|
29
|
+
* </PortalProvider>
|
|
30
|
+
* );
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
const PortalHostComponent = ({ name, children, style }: PortalHostProps) => {
|
|
35
|
+
const { dispatch } = usePortalManagerContext();
|
|
36
|
+
const scrollViewContext = useContext(ScrollViewContext);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
dispatch({ type: "REGISTER_HOST", hostName: name });
|
|
40
|
+
|
|
41
|
+
return () => {
|
|
42
|
+
dispatch({ type: "UNREGISTER_HOST", hostName: name });
|
|
43
|
+
};
|
|
44
|
+
}, [name, dispatch]);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
dispatch({
|
|
48
|
+
type: "SET_HOST_SCROLL_VIEW_CONTEXT",
|
|
49
|
+
hostName: name,
|
|
50
|
+
value: scrollViewContext,
|
|
51
|
+
});
|
|
52
|
+
}, [name, dispatch, scrollViewContext]);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<PortalHost name={name} style={style}>
|
|
56
|
+
{children}
|
|
57
|
+
</PortalHost>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default PortalHostComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/views/PortalHost/index.native.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
import PortalHostNativeComponent from "./specs/PortalHostViewNativeComponent";
|
|
8
|
+
import type { PortalHostProps } from "./types";
|
|
9
|
+
|
|
10
|
+
const PortalHost = (props: PortalHostProps) => {
|
|
11
|
+
return <PortalHostNativeComponent pointerEvents="box-none" {...props} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default PortalHost;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM react-native-teleport 1.2.0 — `src/views/PortalHost/index.tsx`
|
|
3
|
+
* MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
|
|
4
|
+
*
|
|
5
|
+
* Changed: import paths only, for this flat directory.
|
|
6
|
+
*/
|
|
7
|
+
import { memo, useEffect } from "react";
|
|
8
|
+
import { usePortalRegistryContext } from "./portal-registry";
|
|
9
|
+
import type { PortalHostProps } from "./types";
|
|
10
|
+
|
|
11
|
+
function PortalHost({ name, children, style }: PortalHostProps) {
|
|
12
|
+
const { registerHost } = usePortalRegistryContext();
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
return () => {
|
|
16
|
+
registerHost(name, null);
|
|
17
|
+
};
|
|
18
|
+
}, [name, registerHost]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
style={{ ...style, pointerEvents: "none" } as React.CSSProperties}
|
|
23
|
+
ref={(ref) => registerHost(name, ref)}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default memo(PortalHost);
|