@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.
Files changed (232) hide show
  1. package/docs/getting-started.mdx +29 -15
  2. package/docs/media-flight.mdx +14 -9
  3. package/docs/teleport.mdx +72 -0
  4. package/lib/commonjs/connection-status/index.js +7 -0
  5. package/lib/commonjs/connection-status/index.js.map +1 -1
  6. package/lib/commonjs/connection-status/index.web.js +7 -0
  7. package/lib/commonjs/connection-status/index.web.js.map +1 -1
  8. package/lib/commonjs/connection-status/netinfo.js +34 -0
  9. package/lib/commonjs/connection-status/netinfo.js.map +1 -1
  10. package/lib/commonjs/teleport/Portal.js +109 -0
  11. package/lib/commonjs/teleport/Portal.js.map +1 -0
  12. package/lib/commonjs/teleport/PortalHost.js +75 -0
  13. package/lib/commonjs/teleport/PortalHost.js.map +1 -0
  14. package/lib/commonjs/teleport/PortalHostView.js +40 -0
  15. package/lib/commonjs/teleport/PortalHostView.js.map +1 -0
  16. package/lib/commonjs/teleport/PortalHostView.native.js +24 -0
  17. package/lib/commonjs/teleport/PortalHostView.native.js.map +1 -0
  18. package/lib/commonjs/teleport/PortalProvider.js +57 -0
  19. package/lib/commonjs/teleport/PortalProvider.js.map +1 -0
  20. package/lib/commonjs/teleport/PortalProviderView.js +59 -0
  21. package/lib/commonjs/teleport/PortalProviderView.js.map +1 -0
  22. package/lib/commonjs/teleport/PortalProviderView.native.js +19 -0
  23. package/lib/commonjs/teleport/PortalProviderView.native.js.map +1 -0
  24. package/lib/commonjs/teleport/PortalView.js +83 -0
  25. package/lib/commonjs/teleport/PortalView.js.map +1 -0
  26. package/lib/commonjs/teleport/PortalView.native.js +14 -0
  27. package/lib/commonjs/teleport/PortalView.native.js.map +1 -0
  28. package/lib/commonjs/teleport/index.js +35 -0
  29. package/lib/commonjs/teleport/index.js.map +1 -0
  30. package/lib/commonjs/teleport/portal-manager.js +40 -0
  31. package/lib/commonjs/teleport/portal-manager.js.map +1 -0
  32. package/lib/commonjs/teleport/portal-registry.js +24 -0
  33. package/lib/commonjs/teleport/portal-registry.js.map +1 -0
  34. package/lib/commonjs/teleport/reducer.js +86 -0
  35. package/lib/commonjs/teleport/reducer.js.map +1 -0
  36. package/lib/commonjs/teleport/scroll-view-context/context.js +17 -0
  37. package/lib/commonjs/teleport/scroll-view-context/context.js.map +1 -0
  38. package/lib/commonjs/teleport/scroll-view-context/context.native.js +22 -0
  39. package/lib/commonjs/teleport/scroll-view-context/context.native.js.map +1 -0
  40. package/lib/commonjs/teleport/scroll-view-context/types.js +2 -0
  41. package/lib/commonjs/teleport/scroll-view-context/types.js.map +1 -0
  42. package/lib/commonjs/teleport/specs/PortalHostViewNativeComponent.js +17 -0
  43. package/lib/commonjs/teleport/specs/PortalHostViewNativeComponent.js.map +1 -0
  44. package/lib/commonjs/teleport/specs/PortalViewNativeComponent.js +17 -0
  45. package/lib/commonjs/teleport/specs/PortalViewNativeComponent.js.map +1 -0
  46. package/lib/commonjs/teleport/teleport-global.d.js +2 -0
  47. package/lib/commonjs/teleport/teleport-global.d.js.map +1 -0
  48. package/lib/commonjs/teleport/types.js +6 -0
  49. package/lib/commonjs/teleport/types.js.map +1 -0
  50. package/lib/commonjs/teleport/use-id.js +24 -0
  51. package/lib/commonjs/teleport/use-id.js.map +1 -0
  52. package/lib/commonjs/teleport/use-portal.js +59 -0
  53. package/lib/commonjs/teleport/use-portal.js.map +1 -0
  54. package/lib/commonjs/theme/adaptive-colors.js +30 -4
  55. package/lib/commonjs/theme/adaptive-colors.js.map +1 -1
  56. package/lib/module/connection-status/index.js +3 -0
  57. package/lib/module/connection-status/index.js.map +1 -1
  58. package/lib/module/connection-status/index.web.js +3 -0
  59. package/lib/module/connection-status/index.web.js.map +1 -1
  60. package/lib/module/connection-status/netinfo.js +33 -0
  61. package/lib/module/connection-status/netinfo.js.map +1 -1
  62. package/lib/module/teleport/Portal.js +103 -0
  63. package/lib/module/teleport/Portal.js.map +1 -0
  64. package/lib/module/teleport/PortalHost.js +71 -0
  65. package/lib/module/teleport/PortalHost.js.map +1 -0
  66. package/lib/module/teleport/PortalHostView.js +35 -0
  67. package/lib/module/teleport/PortalHostView.js.map +1 -0
  68. package/lib/module/teleport/PortalHostView.native.js +18 -0
  69. package/lib/module/teleport/PortalHostView.native.js.map +1 -0
  70. package/lib/module/teleport/PortalProvider.js +51 -0
  71. package/lib/module/teleport/PortalProvider.js.map +1 -0
  72. package/lib/module/teleport/PortalProviderView.js +54 -0
  73. package/lib/module/teleport/PortalProviderView.js.map +1 -0
  74. package/lib/module/teleport/PortalProviderView.native.js +15 -0
  75. package/lib/module/teleport/PortalProviderView.native.js.map +1 -0
  76. package/lib/module/teleport/PortalView.js +79 -0
  77. package/lib/module/teleport/PortalView.js.map +1 -0
  78. package/lib/module/teleport/PortalView.native.js +10 -0
  79. package/lib/module/teleport/PortalView.native.js.map +1 -0
  80. package/lib/module/teleport/index.js +30 -0
  81. package/lib/module/teleport/index.js.map +1 -0
  82. package/lib/module/teleport/portal-manager.js +33 -0
  83. package/lib/module/teleport/portal-manager.js.map +1 -0
  84. package/lib/module/teleport/portal-registry.js +18 -0
  85. package/lib/module/teleport/portal-registry.js.map +1 -0
  86. package/lib/module/teleport/reducer.js +81 -0
  87. package/lib/module/teleport/reducer.js.map +1 -0
  88. package/lib/module/teleport/scroll-view-context/context.js +12 -0
  89. package/lib/module/teleport/scroll-view-context/context.js.map +1 -0
  90. package/lib/module/teleport/scroll-view-context/context.native.js +18 -0
  91. package/lib/module/teleport/scroll-view-context/context.native.js.map +1 -0
  92. package/lib/module/teleport/scroll-view-context/types.js +2 -0
  93. package/lib/module/teleport/scroll-view-context/types.js.map +1 -0
  94. package/lib/module/teleport/specs/PortalHostViewNativeComponent.js +13 -0
  95. package/lib/module/teleport/specs/PortalHostViewNativeComponent.js.map +1 -0
  96. package/lib/module/teleport/specs/PortalViewNativeComponent.js +13 -0
  97. package/lib/module/teleport/specs/PortalViewNativeComponent.js.map +1 -0
  98. package/lib/module/teleport/teleport-global.d.js +2 -0
  99. package/lib/module/teleport/teleport-global.d.js.map +1 -0
  100. package/lib/module/teleport/types.js +4 -0
  101. package/lib/module/teleport/types.js.map +1 -0
  102. package/lib/module/teleport/use-id.js +19 -0
  103. package/lib/module/teleport/use-id.js.map +1 -0
  104. package/lib/module/teleport/use-portal.js +55 -0
  105. package/lib/module/teleport/use-portal.js.map +1 -0
  106. package/lib/module/theme/adaptive-colors.js +30 -4
  107. package/lib/module/theme/adaptive-colors.js.map +1 -1
  108. package/lib/typescript/commonjs/connection-status/index.d.ts +1 -0
  109. package/lib/typescript/commonjs/connection-status/index.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/connection-status/index.web.d.ts +1 -0
  111. package/lib/typescript/commonjs/connection-status/index.web.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/connection-status/netinfo.d.ts +25 -0
  113. package/lib/typescript/commonjs/connection-status/netinfo.d.ts.map +1 -1
  114. package/lib/typescript/commonjs/teleport/Portal.d.ts +48 -0
  115. package/lib/typescript/commonjs/teleport/Portal.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/teleport/PortalHost.d.ts +25 -0
  117. package/lib/typescript/commonjs/teleport/PortalHost.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/teleport/PortalHostView.d.ts +5 -0
  119. package/lib/typescript/commonjs/teleport/PortalHostView.d.ts.map +1 -0
  120. package/lib/typescript/commonjs/teleport/PortalHostView.native.d.ts +4 -0
  121. package/lib/typescript/commonjs/teleport/PortalHostView.native.d.ts.map +1 -0
  122. package/lib/typescript/commonjs/teleport/PortalProvider.d.ts +23 -0
  123. package/lib/typescript/commonjs/teleport/PortalProvider.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/teleport/PortalProviderView.d.ts +3 -0
  125. package/lib/typescript/commonjs/teleport/PortalProviderView.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/teleport/PortalProviderView.native.d.ts +9 -0
  127. package/lib/typescript/commonjs/teleport/PortalProviderView.native.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/teleport/PortalView.d.ts +9 -0
  129. package/lib/typescript/commonjs/teleport/PortalView.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/teleport/PortalView.native.d.ts +8 -0
  131. package/lib/typescript/commonjs/teleport/PortalView.native.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/teleport/index.d.ts +29 -0
  133. package/lib/typescript/commonjs/teleport/index.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/teleport/portal-manager.d.ts +16 -0
  135. package/lib/typescript/commonjs/teleport/portal-manager.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/teleport/portal-registry.d.ts +10 -0
  137. package/lib/typescript/commonjs/teleport/portal-registry.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/teleport/reducer.d.ts +40 -0
  139. package/lib/typescript/commonjs/teleport/reducer.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/teleport/scroll-view-context/context.d.ts +4 -0
  141. package/lib/typescript/commonjs/teleport/scroll-view-context/context.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/teleport/scroll-view-context/context.native.d.ts +13 -0
  143. package/lib/typescript/commonjs/teleport/scroll-view-context/context.native.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/teleport/scroll-view-context/types.d.ts +10 -0
  145. package/lib/typescript/commonjs/teleport/scroll-view-context/types.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/teleport/specs/PortalHostViewNativeComponent.d.ts +13 -0
  147. package/lib/typescript/commonjs/teleport/specs/PortalHostViewNativeComponent.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/teleport/specs/PortalViewNativeComponent.d.ts +14 -0
  149. package/lib/typescript/commonjs/teleport/specs/PortalViewNativeComponent.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/teleport/types.d.ts +22 -0
  151. package/lib/typescript/commonjs/teleport/types.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/teleport/use-id.d.ts +2 -0
  153. package/lib/typescript/commonjs/teleport/use-id.d.ts.map +1 -0
  154. package/lib/typescript/commonjs/teleport/use-portal.d.ts +35 -0
  155. package/lib/typescript/commonjs/teleport/use-portal.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/theme/adaptive-colors.d.ts.map +1 -1
  157. package/lib/typescript/module/connection-status/index.d.ts +1 -0
  158. package/lib/typescript/module/connection-status/index.d.ts.map +1 -1
  159. package/lib/typescript/module/connection-status/index.web.d.ts +1 -0
  160. package/lib/typescript/module/connection-status/index.web.d.ts.map +1 -1
  161. package/lib/typescript/module/connection-status/netinfo.d.ts +25 -0
  162. package/lib/typescript/module/connection-status/netinfo.d.ts.map +1 -1
  163. package/lib/typescript/module/teleport/Portal.d.ts +48 -0
  164. package/lib/typescript/module/teleport/Portal.d.ts.map +1 -0
  165. package/lib/typescript/module/teleport/PortalHost.d.ts +25 -0
  166. package/lib/typescript/module/teleport/PortalHost.d.ts.map +1 -0
  167. package/lib/typescript/module/teleport/PortalHostView.d.ts +5 -0
  168. package/lib/typescript/module/teleport/PortalHostView.d.ts.map +1 -0
  169. package/lib/typescript/module/teleport/PortalHostView.native.d.ts +4 -0
  170. package/lib/typescript/module/teleport/PortalHostView.native.d.ts.map +1 -0
  171. package/lib/typescript/module/teleport/PortalProvider.d.ts +23 -0
  172. package/lib/typescript/module/teleport/PortalProvider.d.ts.map +1 -0
  173. package/lib/typescript/module/teleport/PortalProviderView.d.ts +3 -0
  174. package/lib/typescript/module/teleport/PortalProviderView.d.ts.map +1 -0
  175. package/lib/typescript/module/teleport/PortalProviderView.native.d.ts +9 -0
  176. package/lib/typescript/module/teleport/PortalProviderView.native.d.ts.map +1 -0
  177. package/lib/typescript/module/teleport/PortalView.d.ts +9 -0
  178. package/lib/typescript/module/teleport/PortalView.d.ts.map +1 -0
  179. package/lib/typescript/module/teleport/PortalView.native.d.ts +8 -0
  180. package/lib/typescript/module/teleport/PortalView.native.d.ts.map +1 -0
  181. package/lib/typescript/module/teleport/index.d.ts +29 -0
  182. package/lib/typescript/module/teleport/index.d.ts.map +1 -0
  183. package/lib/typescript/module/teleport/portal-manager.d.ts +16 -0
  184. package/lib/typescript/module/teleport/portal-manager.d.ts.map +1 -0
  185. package/lib/typescript/module/teleport/portal-registry.d.ts +10 -0
  186. package/lib/typescript/module/teleport/portal-registry.d.ts.map +1 -0
  187. package/lib/typescript/module/teleport/reducer.d.ts +40 -0
  188. package/lib/typescript/module/teleport/reducer.d.ts.map +1 -0
  189. package/lib/typescript/module/teleport/scroll-view-context/context.d.ts +4 -0
  190. package/lib/typescript/module/teleport/scroll-view-context/context.d.ts.map +1 -0
  191. package/lib/typescript/module/teleport/scroll-view-context/context.native.d.ts +13 -0
  192. package/lib/typescript/module/teleport/scroll-view-context/context.native.d.ts.map +1 -0
  193. package/lib/typescript/module/teleport/scroll-view-context/types.d.ts +10 -0
  194. package/lib/typescript/module/teleport/scroll-view-context/types.d.ts.map +1 -0
  195. package/lib/typescript/module/teleport/specs/PortalHostViewNativeComponent.d.ts +13 -0
  196. package/lib/typescript/module/teleport/specs/PortalHostViewNativeComponent.d.ts.map +1 -0
  197. package/lib/typescript/module/teleport/specs/PortalViewNativeComponent.d.ts +14 -0
  198. package/lib/typescript/module/teleport/specs/PortalViewNativeComponent.d.ts.map +1 -0
  199. package/lib/typescript/module/teleport/types.d.ts +22 -0
  200. package/lib/typescript/module/teleport/types.d.ts.map +1 -0
  201. package/lib/typescript/module/teleport/use-id.d.ts +2 -0
  202. package/lib/typescript/module/teleport/use-id.d.ts.map +1 -0
  203. package/lib/typescript/module/teleport/use-portal.d.ts +35 -0
  204. package/lib/typescript/module/teleport/use-portal.d.ts.map +1 -0
  205. package/lib/typescript/module/theme/adaptive-colors.d.ts.map +1 -1
  206. package/package.json +15 -1
  207. package/src/connection-status/index.ts +3 -0
  208. package/src/connection-status/index.web.ts +3 -0
  209. package/src/connection-status/netinfo.ts +33 -0
  210. package/src/teleport/Portal.tsx +97 -0
  211. package/src/teleport/PortalHost.tsx +61 -0
  212. package/src/teleport/PortalHostView.native.tsx +14 -0
  213. package/src/teleport/PortalHostView.tsx +30 -0
  214. package/src/teleport/PortalProvider.tsx +51 -0
  215. package/src/teleport/PortalProviderView.native.tsx +11 -0
  216. package/src/teleport/PortalProviderView.tsx +67 -0
  217. package/src/teleport/PortalView.native.tsx +7 -0
  218. package/src/teleport/PortalView.tsx +94 -0
  219. package/src/teleport/index.ts +32 -0
  220. package/src/teleport/portal-manager.tsx +48 -0
  221. package/src/teleport/portal-registry.ts +27 -0
  222. package/src/teleport/reducer.ts +94 -0
  223. package/src/teleport/scroll-view-context/context.native.ts +19 -0
  224. package/src/teleport/scroll-view-context/context.ts +12 -0
  225. package/src/teleport/scroll-view-context/types.ts +7 -0
  226. package/src/teleport/specs/PortalHostViewNativeComponent.ts +15 -0
  227. package/src/teleport/specs/PortalViewNativeComponent.ts +16 -0
  228. package/src/teleport/teleport-global.d.ts +11 -0
  229. package/src/teleport/types.ts +22 -0
  230. package/src/teleport/use-id.ts +18 -0
  231. package/src/teleport/use-portal.ts +47 -0
  232. package/src/theme/adaptive-colors.ts +37 -4
@@ -67,32 +67,46 @@ export function Hello() {
67
67
  ## If you build with Vite (or any ESM web bundler)
68
68
 
69
69
  Bloom reaches its **optional** peers through a `require()` that Metro marks
70
- optional. An ESM web bundle has no `require` at all measured: `typeof require`
71
- is `undefined` in a Vite bundle so those loads cannot run and every optional
72
- peer degrades **even when the package is installed**. Metro is unaffected, which
73
- is why this only appears off Metro.
70
+ optional. Off Metro that load does not deliver the package **even when it is
71
+ installed** and the reason depends on your bundler, which is why this defect
72
+ keeps being diagnosed wrongly:
74
73
 
75
- **Check in one line**, in your app's console:
74
+ | bundler | `typeof require` | what happens |
75
+ | --- | --- | --- |
76
+ | Rollup / Vite | `"undefined"` | the guard sees no `require` and degrades |
77
+ | esbuild | `"function"` | a shim that THROWS, so the guard passes and the call fails inside the `try` |
76
78
 
77
- ```js
78
- typeof require // "undefined" -> the optional peers below are inert for you
79
- ```
79
+ Same symptom, different causes — so `typeof require` is **not** a reliable check
80
+ for whether you are affected. Metro is unaffected.
81
+
82
+ **What you actually lose on web is the connection toasts**, and only those:
83
+ `ConnectionStatusToasts` calls `loadNetInfo()` with no platform guard, so a web
84
+ app with `@react-native-community/netinfo` installed gets no outage toast.
85
+
86
+ **The other optional peers are NOT affected on web**, because their callers
87
+ return before the `require` is ever reached:
80
88
 
81
- Today one of them can be handed over explicitly:
89
+ | peer | why web never reaches it |
90
+ | --- | --- |
91
+ | `expo-router` (adaptive colours) | `getAdaptiveColors` returns `null` unless `Platform.OS` is `android`/`ios` (`theme/adaptive-colors.ts:143-145`) |
92
+ | `nativewind` (scoped presets) | both callers `return` on web (`theme/color-scope/style-builder.ts:159, :192`) |
93
+ | `expo-haptics` | `useHaptics` returns on web (`hooks/use-haptics.tsx:47`) |
94
+
95
+ If scoped NativeWind presets are wrong in your web app, this is not the cause —
96
+ look at the CSS-variable pipeline instead.
97
+
98
+ Two peers can be handed over explicitly, which works on any bundler:
82
99
 
83
100
  ```ts
84
101
  import * as ExpoVideo from 'expo-video';
102
+ import NetInfo from '@react-native-community/netinfo';
85
103
  import { provideExpoVideo } from '@oxyhq/bloom/media-flight';
104
+ import { provideNetInfo } from '@oxyhq/bloom/connection-status';
86
105
 
87
106
  provideExpoVideo(ExpoVideo); // otherwise video silently shows only its poster
107
+ provideNetInfo(NetInfo); // otherwise the outage toast never appears
88
108
  ```
89
109
 
90
- The others have no equivalent yet, so on an ESM bundle you currently lose
91
- scoped NativeWind presets (`BloomColorScope`), adaptive colours, haptics and the
92
- connection toasts. Most of them say so in the dev console — the warning ends
93
- `Reason: this bundle has no CommonJS require` — with the exception noted in
94
- `theme/adaptive-colors.ts`, which degrades silently.
95
-
96
110
  ## Recommended layout
97
111
 
98
112
  If your app supports both light and dark themes:
@@ -583,13 +583,19 @@ flies video without it gets the poster plus a single dev warning naming the
583
583
  package.
584
584
 
585
585
  <Callout variant="warning" title="On Vite (or any ESM web bundler) you must hand expo-video over">
586
- Bloom loads optional peers through a `require()` that Metro marks optional.
587
- **An ESM web bundle has no `require` at all** measured: `typeof require` is
588
- `undefined` in a Vite bundle — so the load cannot run and video degrades to its
589
- poster **even when `expo-video` is installed**. Metro has a real `require` and
590
- is unaffected, which is why this only shows up off Metro.
586
+ Bloom loads optional peers through a `require()` that Metro marks optional. Off
587
+ Metro that load does not deliver the package **even when `expo-video` is
588
+ installed**, and video degrades to its poster.
591
589
 
592
- One line at startup fixes it:
590
+ **Do not test for this with `typeof require`.** The cause depends on the
591
+ bundler and the symptom does not:
592
+
593
+ | bundler | `typeof require` | what happens |
594
+ | --- | --- | --- |
595
+ | Rollup / Vite | `"undefined"` | the guard sees no `require` and degrades |
596
+ | esbuild | `"function"` | a shim that THROWS, so the guard passes and the call fails inside the `try` |
597
+
598
+ One line at startup fixes it, on any bundler:
593
599
 
594
600
  ```ts
595
601
  import * as ExpoVideo from 'expo-video';
@@ -598,9 +604,8 @@ import { provideExpoVideo } from '@oxyhq/bloom/media-flight';
598
604
  provideExpoVideo(ExpoVideo);
599
605
  ```
600
606
 
601
- How to tell whether it applies to you: run `typeof require` in your app's
602
- console. If it answers `"undefined"`, you need this. The dev console also says
603
- so directly — the warning ends `Reason: this bundle has no CommonJS require`.
607
+ The dev console says so too, and the `Reason:` it prints is the bundler's own
608
+ message rather than a fixed string.
604
609
  </Callout>
605
610
 
606
611
  ## What a jest run can and cannot see
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Teleport
3
+ description: react-native-teleport, vendored — one view moved between hosts, not rebuilt at each end
4
+ ---
5
+
6
+ # Teleport
7
+
8
+ `@oxyhq/bloom/teleport` is **a copy of [react-native-teleport][upstream] 1.2.0**,
9
+ by Kiryl Ziusko, MIT-licensed. It is not a reimplementation and not an
10
+ adaptation: the files under `src/teleport/` are theirs, each one carrying a
11
+ header that names the file it came from and what changed — import paths, in
12
+ almost every case, and nothing else.
13
+
14
+ The full licence is in `NOTICE` at the repository root, and it ships in the
15
+ published tarball.
16
+
17
+ [upstream]: https://github.com/kirillzyusko/react-native-teleport
18
+
19
+ ## Why Bloom carries it rather than depending on it
20
+
21
+ Bloom needs its **native re-parenting**: moving one platform view between hosts
22
+ instead of mounting a second one somewhere else. That arrives as Fabric
23
+ components — C++ shadow nodes, Kotlin, Objective-C++ — not as JavaScript, and
24
+ Bloom's media flight is the consumer.
25
+
26
+ Vendoring is a decision with a cost, and the cost is that **this is a fork**.
27
+ Their fixes will not arrive here on their own; their repository is active. Read
28
+ theirs before rewriting anything here.
29
+
30
+ ## The one thing Bloom does differently, and it is not their code
31
+
32
+ **Bloom mounts these portals from its ROOT LAYER. Never from the origin screen.**
33
+
34
+ Their `<Portal>` renders `createPortal(children, …)` inside the component that
35
+ mounts it, so the children belong to that component's tree. Their Instagram
36
+ recipe mounts it inside the screen the media starts on and keeps that screen
37
+ alive with `presentation: 'transparentModal'`, which is correct for a navigator
38
+ that behaves that way — and it is the premise the design needs.
39
+
40
+ Under expo-router on **web** the origin route is unmounted the moment the URL
41
+ changes. Measured against their library, with the origin unmounting:
42
+
43
+ ```
44
+ origin UNMOUNTS count 1 -> 0 -> 0 the media is gone
45
+ origin STAYS stamps ["1","1","1"], ct 0.93 -> 1.73 one element, still playing
46
+ ```
47
+
48
+ The portal is not what fails there; the **ownership** is. Same piece, mounted
49
+ where it does not die — which is what `MediaFlightLayer` does.
50
+
51
+ `src/__tests__/Teleport.test.tsx` pins all three behaviours, including that last
52
+ one, so nobody re-discovers it in an app.
53
+
54
+ ## Status
55
+
56
+ - **Web: in, and used.** The move primitive in `media-flight/media-node.web.ts`
57
+ is theirs (`moveBefore` with an `insertBefore` fallback).
58
+ - **Native: not yet.** The Fabric components are not in this repo. Until they
59
+ are, Bloom's native flight keeps its three surfaces on one player.
60
+ - **Their own test suite is not here yet, and the reason is measured.** It is
61
+ written for `preset: react-native`, and Bloom's jest resolves no platform
62
+ extensions, so it reaches the web files instead. Moving their tests to a web
63
+ renderer does not work either: they depend on react-native-testing-library's
64
+ API, not only its renderer — `fireEvent.press` and `toBeOnTheScreen` appear
65
+ 37 times in one 221-line file, and neither exists in
66
+ `@testing-library/react`. Rewriting those is rewriting every interaction and
67
+ every assertion, which is not vendoring their tests, it is writing ours.
68
+
69
+ So they arrive with the native side, which is what they were written for. They
70
+ are held, not `.skip`ped: a skipped vendored test claims coverage that does not
71
+ exist. Meanwhile `src/__tests__/Teleport.test.tsx` covers their code on the
72
+ path Bloom uses today. See `AGENTS.md`, "Jest resolves no platform extensions".
@@ -9,5 +9,12 @@ Object.defineProperty(exports, "ConnectionStatusToasts", {
9
9
  return _ConnectionStatusToasts.ConnectionStatusToasts;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "provideNetInfo", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _netinfo.provideNetInfo;
16
+ }
17
+ });
18
+ var _netinfo = require("./netinfo.js");
12
19
  var _ConnectionStatusToasts = require("./ConnectionStatusToasts");
13
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ConnectionStatusToasts","require"],"sourceRoot":"../../../src","sources":["connection-status/index.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,uBAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_netinfo","require","_ConnectionStatusToasts"],"sourceRoot":"../../../src","sources":["connection-status/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA","ignoreList":[]}
@@ -9,5 +9,12 @@ Object.defineProperty(exports, "ConnectionStatusToasts", {
9
9
  return _ConnectionStatusToastsWeb.ConnectionStatusToasts;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "provideNetInfo", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _netinfo.provideNetInfo;
16
+ }
17
+ });
18
+ var _netinfo = require("./netinfo.js");
12
19
  var _ConnectionStatusToastsWeb = require("./ConnectionStatusToasts.web.js");
13
20
  //# sourceMappingURL=index.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ConnectionStatusToastsWeb","require"],"sourceRoot":"../../../src","sources":["connection-status/index.web.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,0BAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_netinfo","require","_ConnectionStatusToastsWeb"],"sourceRoot":"../../../src","sources":["connection-status/index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.loadNetInfo = loadNetInfo;
7
+ exports.provideNetInfo = provideNetInfo;
7
8
  exports.warnNetInfoUnavailable = warnNetInfoUnavailable;
8
9
  /**
9
10
  * The optional-peer boundary for `@react-native-community/netinfo`.
@@ -68,12 +69,45 @@ exports.warnNetInfoUnavailable = warnNetInfoUnavailable;
68
69
 
69
70
  /** `undefined` until the first load attempt, then the module or `null`. */
70
71
  let netInfoModule;
72
+ /** Handed in by a consumer, which is the only thing that works in an ESM bundle. */
73
+ let providedModule = null;
71
74
  /** Why the load failed, quoted verbatim in the dev warning. */
72
75
  let unavailableReason = '';
73
76
  let hasWarned = false;
74
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
+ function provideNetInfo(module) {
103
+ providedModule = module;
104
+ netInfoModule = undefined;
105
+ hasWarned = false;
106
+ }
107
+
75
108
  /** The netinfo module, or `null` when the optional peer is not installed. */
76
109
  function loadNetInfo() {
110
+ if (providedModule !== null) return providedModule;
77
111
  if (netInfoModule !== undefined) return netInfoModule;
78
112
  netInfoModule = null;
79
113
 
@@ -1 +1 @@
1
- {"version":3,"names":["netInfoModule","unavailableReason","hasWarned","loadNetInfo","undefined","require","loaded","resolved","addEventListener","default","error","Error","message","String","warnNetInfoUnavailable","process","env","NODE_ENV","console","warn"],"sourceRoot":"../../../src","sources":["connection-status/netinfo.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAGA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,IAAIA,aAA6C;AACjD;AACA,IAAIC,iBAAiB,GAAG,EAAE;AAC1B,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACO,SAASC,WAAWA,CAAA,EAAuB;EAChD,IAAIH,aAAa,KAAKI,SAAS,EAAE,OAAOJ,aAAa;EACrDA,aAAa,GAAG,IAAI;;EAEpB;EACA;EACA;EACA;EACA,IAAI,OAAOK,OAAO,KAAK,WAAW,EAAE;IAClCJ,iBAAiB,GAAG,uCAAuC;IAC3D,OAAOD,aAAa;EACtB;EAEA,IAAI;IACF;IACA;IACA;IACA,MAAMM,MAAM,GAAGD,OAAO,CAAC,iCAAiC,CAG3C;IACb,MAAME,QAAQ,GAAG,OAAOD,MAAM,EAAEE,gBAAgB,KAAK,UAAU,GAAGF,MAAM,GAAGA,MAAM,EAAEG,OAAO;IAE1F,IAAI,OAAOF,QAAQ,EAAEC,gBAAgB,KAAK,UAAU,EAAE;MACpDR,aAAa,GAAGO,QAAuB;IACzC,CAAC,MAAM;MACLN,iBAAiB,GAAG,0DAA0D;IAChF;EACF,CAAC,CAAC,OAAOS,KAAK,EAAE;IACdT,iBAAiB,GAAGS,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAC;EAC5E;EAEA,OAAOV,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,sBAAsBA,CAAA,EAAS;EAC7C,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIf,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACA;EACA;EACAgB,OAAO,CAACC,IAAI,CACV,6DAA6D,GAC3D,+EAA+E,GAC/E,8EAA8E,GAC9E,6EAA6E,GAC7E,oDAAoDlB,iBAAiB,EACzE,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["netInfoModule","providedModule","unavailableReason","hasWarned","provideNetInfo","module","undefined","loadNetInfo","require","loaded","resolved","addEventListener","default","error","Error","message","String","warnNetInfoUnavailable","process","env","NODE_ENV","console","warn"],"sourceRoot":"../../../src","sources":["connection-status/netinfo.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAGA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA,IAAIA,aAA6C;AACjD;AACA,IAAIC,cAAkC,GAAG,IAAI;AAC7C;AACA,IAAIC,iBAAiB,GAAG,EAAE;AAC1B,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,MAA0B,EAAQ;EAC/DJ,cAAc,GAAGI,MAAM;EACvBL,aAAa,GAAGM,SAAS;EACzBH,SAAS,GAAG,KAAK;AACnB;;AAEA;AACO,SAASI,WAAWA,CAAA,EAAuB;EAChD,IAAIN,cAAc,KAAK,IAAI,EAAE,OAAOA,cAAc;EAClD,IAAID,aAAa,KAAKM,SAAS,EAAE,OAAON,aAAa;EACrDA,aAAa,GAAG,IAAI;;EAEpB;EACA;EACA;EACA;EACA,IAAI,OAAOQ,OAAO,KAAK,WAAW,EAAE;IAClCN,iBAAiB,GAAG,uCAAuC;IAC3D,OAAOF,aAAa;EACtB;EAEA,IAAI;IACF;IACA;IACA;IACA,MAAMS,MAAM,GAAGD,OAAO,CAAC,iCAAiC,CAG3C;IACb,MAAME,QAAQ,GAAG,OAAOD,MAAM,EAAEE,gBAAgB,KAAK,UAAU,GAAGF,MAAM,GAAGA,MAAM,EAAEG,OAAO;IAE1F,IAAI,OAAOF,QAAQ,EAAEC,gBAAgB,KAAK,UAAU,EAAE;MACpDX,aAAa,GAAGU,QAAuB;IACzC,CAAC,MAAM;MACLR,iBAAiB,GAAG,0DAA0D;IAChF;EACF,CAAC,CAAC,OAAOW,KAAK,EAAE;IACdX,iBAAiB,GAAGW,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAC;EAC5E;EAEA,OAAOb,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASiB,sBAAsBA,CAAA,EAAS;EAC7C,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIjB,SAAS,EAAE;EACxDA,SAAS,GAAG,IAAI;EAChB;EACA;EACA;EACAkB,OAAO,CAACC,IAAI,CACV,6DAA6D,GAC3D,+EAA+E,GAC/E,8EAA8E,GAC9E,6EAA6E,GAC7E,oDAAoDpB,iBAAiB,EACzE,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _portalManager = require("./portal-manager.js");
9
+ var _context = _interopRequireDefault(require("./scroll-view-context/context"));
10
+ var _PortalView = _interopRequireDefault(require("./PortalView"));
11
+ var _useId = _interopRequireDefault(require("./use-id.js"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ /**
15
+ * COPIED FROM react-native-teleport 1.2.0 — `src/components/Portal.tsx`
16
+ * MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
17
+ *
18
+ * Changed: import paths only, for this flat directory.
19
+ */
20
+
21
+ /**
22
+ * Portal helps you to render a component in a different place in the view hierarchy.
23
+ * This is useful when you need a view to visually “break out” of its parent container (for example: modals, toasts, floating UI, popovers).
24
+ *
25
+ * @category components
26
+ * @param hostName - The `name` of the `PortalHost`. It's used to identify the host where the content should be rendered.
27
+ * @param name - The name of the portal. It's used to identify the portal.
28
+ * @param children - The content that should be rendered in the portal.
29
+ * @example
30
+ * ```tsx
31
+ * import { useState } from "react";
32
+ * import { View, StyleSheet, Button } from "react-native";
33
+ * import { Portal } from "react-native-teleport";
34
+ * export default function InstantRootExample() {
35
+ * const [shouldBeTeleported, setTeleported] = useState(true);
36
+ * return (
37
+ * <View style={styles.container}>
38
+ * {shouldBeTeleported && (
39
+ * <Portal hostName={"overlay"}>
40
+ * <View style={styles.box} />
41
+ * </Portal>
42
+ * )}
43
+ * <Button
44
+ * title={shouldBeTeleported ? "Hide" : "Show"}
45
+ * onPress={() => setTeleported((t) => !t)}
46
+ * />
47
+ * </View>
48
+ * );
49
+ * }
50
+ * const styles = StyleSheet.create({
51
+ * container: {
52
+ * flex: 1,
53
+ * alignItems: "center",
54
+ * justifyContent: "center",
55
+ * },
56
+ * box: {
57
+ * width: 160,
58
+ * height: 160,
59
+ * marginVertical: 20,
60
+ * backgroundColor: "blue",
61
+ * },
62
+ * });
63
+ * ```
64
+ */
65
+ const PortalComponent = ({
66
+ hostName,
67
+ name,
68
+ style,
69
+ children
70
+ }) => {
71
+ const sourceScrollViewContext = (0, _react.useContext)(_context.default);
72
+ const {
73
+ state,
74
+ dispatch
75
+ } = (0, _portalManager.usePortalManagerContext)();
76
+ const instanceId = (0, _useId.default)();
77
+ const scrollViewContext = hostName && state.hosts[hostName] ? state.hostScrollViewContexts[hostName] ?? null : sourceScrollViewContext;
78
+ const isRemoved = hostName && name ? state.removed[hostName]?.[name]?.[instanceId] : false;
79
+ (0, _react.useEffect)(() => {
80
+ if (!hostName || !name) {
81
+ return;
82
+ }
83
+ dispatch({
84
+ type: "REGISTER_PORTAL",
85
+ hostName,
86
+ name,
87
+ instanceId
88
+ });
89
+ return () => {
90
+ dispatch({
91
+ type: "CLEAR_REMOVED_ON_UNMOUNT",
92
+ hostName,
93
+ name,
94
+ instanceId
95
+ });
96
+ };
97
+ }, [dispatch, hostName, name, instanceId]);
98
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.default.Provider, {
99
+ value: scrollViewContext,
100
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PortalView.default, {
101
+ hostName: hostName,
102
+ name: name,
103
+ style: style,
104
+ children: isRemoved ? null : children
105
+ })
106
+ });
107
+ };
108
+ var _default = exports.default = PortalComponent;
109
+ //# sourceMappingURL=Portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_portalManager","_context","_interopRequireDefault","_PortalView","_useId","_jsxRuntime","e","__esModule","default","PortalComponent","hostName","name","style","children","sourceScrollViewContext","useContext","ScrollViewContext","state","dispatch","usePortalManagerContext","instanceId","useId","scrollViewContext","hosts","hostScrollViewContexts","isRemoved","removed","useEffect","type","jsx","Provider","value","_default","exports"],"sourceRoot":"../../../src","sources":["teleport/Portal.tsx"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAF,sBAAA,CAAAH,OAAA;AAA6B,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAV7B;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,eAAe,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAAsB,CAAC,KAAK;EAC5E,MAAMC,uBAAuB,GAAG,IAAAC,iBAAU,EAACC,gBAAiB,CAAC;EAC7D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAG,IAAAC,sCAAuB,EAAC,CAAC;EACrD,MAAMC,UAAU,GAAG,IAAAC,cAAK,EAAC,CAAC;EAE1B,MAAMC,iBAAiB,GACrBZ,QAAQ,IAAIO,KAAK,CAACM,KAAK,CAACb,QAAQ,CAAC,GAC5BO,KAAK,CAACO,sBAAsB,CAACd,QAAQ,CAAC,IAAI,IAAI,GAC/CI,uBAAuB;EAE7B,MAAMW,SAAS,GACbf,QAAQ,IAAIC,IAAI,GAAGM,KAAK,CAACS,OAAO,CAAChB,QAAQ,CAAC,GAAGC,IAAI,CAAC,GAAGS,UAAU,CAAC,GAAG,KAAK;EAE1E,IAAAO,gBAAS,EAAC,MAAM;IACd,IAAI,CAACjB,QAAQ,IAAI,CAACC,IAAI,EAAE;MACtB;IACF;IAEAO,QAAQ,CAAC;MAAEU,IAAI,EAAE,iBAAiB;MAAElB,QAAQ;MAAEC,IAAI;MAAES;IAAW,CAAC,CAAC;IAEjE,OAAO,MAAM;MACXF,QAAQ,CAAC;QACPU,IAAI,EAAE,0BAA0B;QAChClB,QAAQ;QACRC,IAAI;QACJS;MACF,CAAC,CAAC;IACJ,CAAC;EACH,CAAC,EAAE,CAACF,QAAQ,EAAER,QAAQ,EAAEC,IAAI,EAAES,UAAU,CAAC,CAAC;EAE1C,oBACE,IAAAf,WAAA,CAAAwB,GAAA,EAAC5B,QAAA,CAAAO,OAAiB,CAACsB,QAAQ;IAACC,KAAK,EAAET,iBAAkB;IAAAT,QAAA,eACnD,IAAAR,WAAA,CAAAwB,GAAA,EAAC1B,WAAA,CAAAK,OAAU;MAACE,QAAQ,EAAEA,QAAS;MAACC,IAAI,EAAEA,IAAK;MAACC,KAAK,EAAEA,KAAM;MAAAC,QAAA,EACtDY,SAAS,GAAG,IAAI,GAAGZ;IAAQ,CAClB;EAAC,CACa,CAAC;AAEjC,CAAC;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEaC,eAAe","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _portalManager = require("./portal-manager.js");
9
+ var _context = _interopRequireDefault(require("./scroll-view-context/context"));
10
+ var _PortalHostView = _interopRequireDefault(require("./PortalHostView"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /**
14
+ * COPIED FROM react-native-teleport 1.2.0 — `src/components/PortalHost.tsx`
15
+ * MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
16
+ *
17
+ * Changed: import paths only, for this flat directory.
18
+ */
19
+
20
+ /**
21
+ * PortalHost is a component that acts as an anchor for the portals.
22
+ * You can define multiple portal hosts in your app and use them to render different portals.
23
+ * Each portal host has a unique name that you can use to identify a necessary one among the others.
24
+ *
25
+ * @category components
26
+ * @param name - The name of the portal host. It's used by `<Portal />` component to identify the host.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * import { StyleSheet, View } from "react-native";
31
+ * import { PortalHost, PortalProvider } from "react-native-teleport";
32
+ * export default function App() {
33
+ * return (
34
+ * <PortalProvider>
35
+ * <PortalHost style={StyleSheet.absoluteFillObject} name="overlay" />
36
+ * </PortalProvider>
37
+ * );
38
+ * }
39
+ * ```
40
+ */const PortalHostComponent = ({
41
+ name,
42
+ children,
43
+ style
44
+ }) => {
45
+ const {
46
+ dispatch
47
+ } = (0, _portalManager.usePortalManagerContext)();
48
+ const scrollViewContext = (0, _react.useContext)(_context.default);
49
+ (0, _react.useEffect)(() => {
50
+ dispatch({
51
+ type: "REGISTER_HOST",
52
+ hostName: name
53
+ });
54
+ return () => {
55
+ dispatch({
56
+ type: "UNREGISTER_HOST",
57
+ hostName: name
58
+ });
59
+ };
60
+ }, [name, dispatch]);
61
+ (0, _react.useEffect)(() => {
62
+ dispatch({
63
+ type: "SET_HOST_SCROLL_VIEW_CONTEXT",
64
+ hostName: name,
65
+ value: scrollViewContext
66
+ });
67
+ }, [name, dispatch, scrollViewContext]);
68
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PortalHostView.default, {
69
+ name: name,
70
+ style: style,
71
+ children: children
72
+ });
73
+ };
74
+ var _default = exports.default = PortalHostComponent;
75
+ //# sourceMappingURL=PortalHost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_portalManager","_context","_interopRequireDefault","_PortalHostView","_jsxRuntime","e","__esModule","default","PortalHostComponent","name","children","style","dispatch","usePortalManagerContext","scrollViewContext","useContext","ScrollViewContext","useEffect","type","hostName","value","jsx","_default","exports"],"sourceRoot":"../../../src","sources":["teleport/PortalHost.tsx"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA0C,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAV1C;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMG,mBAAmB,GAAGA,CAAC;EAAEC,IAAI;EAAEC,QAAQ;EAAEC;AAAuB,CAAC,KAAK;EAC1E,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,sCAAuB,EAAC,CAAC;EAC9C,MAAMC,iBAAiB,GAAG,IAAAC,iBAAU,EAACC,gBAAiB,CAAC;EAEvD,IAAAC,gBAAS,EAAC,MAAM;IACdL,QAAQ,CAAC;MAAEM,IAAI,EAAE,eAAe;MAAEC,QAAQ,EAAEV;IAAK,CAAC,CAAC;IAEnD,OAAO,MAAM;MACXG,QAAQ,CAAC;QAAEM,IAAI,EAAE,iBAAiB;QAAEC,QAAQ,EAAEV;MAAK,CAAC,CAAC;IACvD,CAAC;EACH,CAAC,EAAE,CAACA,IAAI,EAAEG,QAAQ,CAAC,CAAC;EAEpB,IAAAK,gBAAS,EAAC,MAAM;IACdL,QAAQ,CAAC;MACPM,IAAI,EAAE,8BAA8B;MACpCC,QAAQ,EAAEV,IAAI;MACdW,KAAK,EAAEN;IACT,CAAC,CAAC;EACJ,CAAC,EAAE,CAACL,IAAI,EAAEG,QAAQ,EAAEE,iBAAiB,CAAC,CAAC;EAEvC,oBACE,IAAAV,WAAA,CAAAiB,GAAA,EAAClB,eAAA,CAAAI,OAAU;IAACE,IAAI,EAAEA,IAAK;IAACE,KAAK,EAAEA,KAAM;IAAAD,QAAA,EAClCA;EAAQ,CACC,CAAC;AAEjB,CAAC;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEaC,mBAAmB","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _portalRegistry = require("./portal-registry.js");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /**
11
+ * COPIED FROM react-native-teleport 1.2.0 — `src/views/PortalHost/index.tsx`
12
+ * MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
13
+ *
14
+ * Changed: import paths only, for this flat directory.
15
+ */
16
+
17
+ function PortalHost({
18
+ name,
19
+ children,
20
+ style
21
+ }) {
22
+ const {
23
+ registerHost
24
+ } = (0, _portalRegistry.usePortalRegistryContext)();
25
+ (0, _react.useEffect)(() => {
26
+ return () => {
27
+ registerHost(name, null);
28
+ };
29
+ }, [name, registerHost]);
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
31
+ style: {
32
+ ...style,
33
+ pointerEvents: "none"
34
+ },
35
+ ref: ref => registerHost(name, ref),
36
+ children: children
37
+ });
38
+ }
39
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(PortalHost);
40
+ //# sourceMappingURL=PortalHostView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_portalRegistry","_jsxRuntime","PortalHost","name","children","style","registerHost","usePortalRegistryContext","useEffect","jsx","pointerEvents","ref","_default","exports","default","memo"],"sourceRoot":"../../../src","sources":["teleport/PortalHostView.tsx"],"mappings":";;;;;;AAMA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAA6D,IAAAE,WAAA,GAAAF,OAAA;AAP7D;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASG,UAAUA,CAAC;EAAEC,IAAI;EAAEC,QAAQ;EAAEC;AAAuB,CAAC,EAAE;EAC9D,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,wCAAwB,EAAC,CAAC;EAEnD,IAAAC,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACXF,YAAY,CAACH,IAAI,EAAE,IAAI,CAAC;IAC1B,CAAC;EACH,CAAC,EAAE,CAACA,IAAI,EAAEG,YAAY,CAAC,CAAC;EAExB,oBACE,IAAAL,WAAA,CAAAQ,GAAA;IACEJ,KAAK,EAAE;MAAE,GAAGA,KAAK;MAAEK,aAAa,EAAE;IAAO,CAAyB;IAClEC,GAAG,EAAGA,GAAG,IAAKL,YAAY,CAACH,IAAI,EAAEQ,GAAG,CAAE;IAAAP,QAAA,EAErCA;EAAQ,CACN,CAAC;AAEV;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,gBAEc,IAAAC,WAAI,EAACb,UAAU,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _PortalHostViewNativeComponent = _interopRequireDefault(require("./specs/PortalHostViewNativeComponent.js"));
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * COPIED FROM react-native-teleport 1.2.0 — `src/views/PortalHost/index.native.tsx`
12
+ * MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
13
+ *
14
+ * Changed: import paths only, for this flat directory.
15
+ */
16
+
17
+ const PortalHost = props => {
18
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PortalHostViewNativeComponent.default, {
19
+ pointerEvents: "box-none",
20
+ ...props
21
+ });
22
+ };
23
+ var _default = exports.default = PortalHost;
24
+ //# sourceMappingURL=PortalHostView.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_PortalHostViewNativeComponent","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","PortalHost","props","jsx","pointerEvents","_default","exports"],"sourceRoot":"../../../src","sources":["teleport/PortalHostView.native.tsx"],"mappings":";;;;;;AAMA,IAAAA,8BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8E,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAN9E;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMG,UAAU,GAAIC,KAAsB,IAAK;EAC7C,oBAAO,IAAAL,WAAA,CAAAM,GAAA,EAACT,8BAAA,CAAAM,OAAyB;IAACI,aAAa,EAAC,UAAU;IAAA,GAAKF;EAAK,CAAG,CAAC;AAC1E,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEaC,UAAU","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = PortalProvider;
7
+ var _PortalHost = _interopRequireDefault(require("./PortalHost.js"));
8
+ var _PortalProviderView = _interopRequireDefault(require("./PortalProviderView"));
9
+ var _portalManager = require("./portal-manager.js");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * COPIED FROM react-native-teleport 1.2.0 — `src/PortalProvider.tsx`
14
+ * MIT, Copyright (c) 2025 Kiryl Ziusko. Full licence in `NOTICE` at the root.
15
+ *
16
+ * Changed: import paths only, for this flat directory.
17
+ */
18
+
19
+ /**
20
+ * Wraps your app with this component to use the teleport API.
21
+ *
22
+ * This component provides a context/registry for all Portals so that you can use imperative API, such as `usePortal` hook to manage Portals.
23
+ *
24
+ * @category components
25
+ * @example
26
+ * ```tsx
27
+ * import { PortalProvider } from "react-native-teleport";
28
+ * export default function App() {
29
+ * return (
30
+ * <PortalProvider>
31
+ * //* your main application code goes here
32
+ * </PortalProvider>
33
+ * );
34
+ * }
35
+ */
36
+ function PortalProvider({
37
+ children
38
+ }) {
39
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PortalProviderView.default, {
40
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_portalManager.PortalManagerProvider, {
41
+ children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_PortalHost.default, {
42
+ name: "root",
43
+ style: styles.root
44
+ })]
45
+ })
46
+ });
47
+ }
48
+ const styles = {
49
+ root: {
50
+ position: "absolute",
51
+ top: 0,
52
+ bottom: 0,
53
+ left: 0,
54
+ right: 0
55
+ }
56
+ };
57
+ //# sourceMappingURL=PortalProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_PortalHost","_interopRequireDefault","require","_PortalProviderView","_portalManager","_jsxRuntime","e","__esModule","default","PortalProvider","children","jsx","jsxs","PortalManagerProvider","name","style","styles","root","position","top","bottom","left","right"],"sourceRoot":"../../../src","sources":["teleport/PortalProvider.tsx"],"mappings":";;;;;;AAMA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAyD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AARzD;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,cAAcA,CAAC;EAAEC;AAA8B,CAAC,EAAE;EACxE,oBACE,IAAAL,WAAA,CAAAM,GAAA,EAACR,mBAAA,CAAAK,OAAoB;IAAAE,QAAA,eACnB,IAAAL,WAAA,CAAAO,IAAA,EAACR,cAAA,CAAAS,qBAAqB;MAAAH,QAAA,GACnBA,QAAQ,eACT,IAAAL,WAAA,CAAAM,GAAA,EAACX,WAAA,CAAAQ,OAAU;QAACM,IAAI,EAAC,MAAM;QAACC,KAAK,EAAEC,MAAM,CAACC;MAAK,CAAE,CAAC;IAAA,CACzB;EAAC,CACJ,CAAC;AAE3B;AAEA,MAAMD,MAAM,GAAG;EACbC,IAAI,EAAE;IACJC,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT;AACF,CAAU","ignoreList":[]}