@aguacerowx/react-native 0.0.53 → 0.0.54

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 (261) hide show
  1. package/LICENSE +21 -0
  2. package/android/src/main/java/com/aguacerowx/reactnative/NexradRadarLayerView.java +14 -2
  3. package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +77 -0
  4. package/index.js +1 -1
  5. package/ios/WeatherFrameProcessorModule.m +19 -15
  6. package/ios/WeatherFrameProcessorModule.swift +65 -0
  7. package/lib/commonjs/AguaceroContext.js +0 -4
  8. package/lib/commonjs/AguaceroContext.js.map +1 -1
  9. package/lib/commonjs/GridRenderLayer.js +62 -76
  10. package/lib/commonjs/GridRenderLayer.js.map +1 -1
  11. package/lib/commonjs/MapManager.js +110 -224
  12. package/lib/commonjs/MapManager.js.map +1 -1
  13. package/lib/commonjs/MapRegistry.js +21 -33
  14. package/lib/commonjs/MapRegistry.js.map +1 -1
  15. package/lib/commonjs/NexradRadarLayer.android.js +28 -100
  16. package/lib/commonjs/NexradRadarLayer.android.js.map +1 -1
  17. package/lib/commonjs/NexradRadarLayer.ios.js +26 -97
  18. package/lib/commonjs/NexradRadarLayer.ios.js.map +1 -1
  19. package/lib/commonjs/NexradSitesMapLayer.js +41 -61
  20. package/lib/commonjs/NexradSitesMapLayer.js.map +1 -1
  21. package/lib/commonjs/SatelliteLayer.android.js +26 -38
  22. package/lib/commonjs/SatelliteLayer.android.js.map +1 -1
  23. package/lib/commonjs/SatelliteLayer.ios.js +30 -42
  24. package/lib/commonjs/SatelliteLayer.ios.js.map +1 -1
  25. package/lib/commonjs/StyleApplicator.js +129 -175
  26. package/lib/commonjs/StyleApplicator.js.map +1 -1
  27. package/lib/commonjs/WeatherLayerManager.js +995 -1646
  28. package/lib/commonjs/WeatherLayerManager.js.map +1 -1
  29. package/lib/commonjs/aguaceroCoreDebugHooks.js +58 -130
  30. package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -1
  31. package/lib/commonjs/aguaceroRnDebug.js +147 -288
  32. package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
  33. package/lib/commonjs/cdnAuthenticatedFetch.js +104 -0
  34. package/lib/commonjs/cdnAuthenticatedFetch.js.map +1 -0
  35. package/lib/commonjs/dispatchViewManagerCommandCompat.js +51 -88
  36. package/lib/commonjs/dispatchViewManagerCommandCompat.js.map +1 -1
  37. package/lib/commonjs/gridCdnAuth.js +41 -50
  38. package/lib/commonjs/gridCdnAuth.js.map +1 -1
  39. package/lib/commonjs/index.js +14 -0
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/nexrad/nexradAndroidController.js +851 -863
  42. package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
  43. package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
  44. package/lib/commonjs/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
  45. package/lib/commonjs/nexrad/nexradDiag.js +32 -148
  46. package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
  47. package/lib/commonjs/nexrad/nexradLevel2Keys.js +261 -0
  48. package/lib/commonjs/nexrad/nexradLevel2Keys.js.map +1 -0
  49. package/lib/commonjs/nexrad/nexradLutBuild.js +64 -111
  50. package/lib/commonjs/nexrad/nexradLutBuild.js.map +1 -1
  51. package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js +136 -164
  52. package/lib/commonjs/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
  53. package/lib/commonjs/nexrad/nexradSdkImports.js +51 -0
  54. package/lib/commonjs/nexrad/nexradSdkImports.js.map +1 -0
  55. package/lib/commonjs/nexrad/radarArchiveCore.bundled.js +2848 -4455
  56. package/lib/commonjs/nexrad/radarArchiveCore.bundled.js.map +1 -1
  57. package/lib/commonjs/nexrad/radarDecode.worker.bundled.js +445 -648
  58. package/lib/commonjs/nexrad/radarDecode.worker.bundled.js.map +1 -1
  59. package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js +52 -68
  60. package/lib/commonjs/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
  61. package/lib/commonjs/nexradNativeCommandIds.js +24 -0
  62. package/lib/commonjs/nexradNativeCommandIds.js.map +1 -0
  63. package/lib/commonjs/nws/NwsAlertsOverlay.android.js.map +1 -1
  64. package/lib/commonjs/nws/NwsAlertsOverlay.ios.js.map +1 -1
  65. package/lib/commonjs/nws/NwsAlertsOverlay.js +3 -3
  66. package/lib/commonjs/nws/NwsAlertsOverlay.js.map +1 -1
  67. package/lib/commonjs/nws/NwsAlertsOverlay.native.js +235 -361
  68. package/lib/commonjs/nws/NwsAlertsOverlay.native.js.map +1 -1
  69. package/lib/commonjs/nws/eventSourceRnPolyfill.js +92 -146
  70. package/lib/commonjs/nws/eventSourceRnPolyfill.js.map +1 -1
  71. package/lib/commonjs/nws/nwsAndroidConstants.js +2 -8
  72. package/lib/commonjs/nws/nwsAndroidConstants.js.map +1 -1
  73. package/lib/commonjs/satellite/satelliteAndroidController.js +117 -202
  74. package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
  75. package/lib/commonjs/satelliteBridgeDiag.js +3 -13
  76. package/lib/commonjs/satelliteBridgeDiag.js.map +1 -1
  77. package/lib/commonjs/satelliteRnDebug.js +117 -218
  78. package/lib/commonjs/satelliteRnDebug.js.map +1 -1
  79. package/lib/module/AguaceroContext.js +2 -7
  80. package/lib/module/AguaceroContext.js.map +1 -1
  81. package/lib/module/GridRenderLayer.js +66 -80
  82. package/lib/module/GridRenderLayer.js.map +1 -1
  83. package/lib/module/MapManager.js +125 -239
  84. package/lib/module/MapManager.js.map +1 -1
  85. package/lib/module/MapRegistry.js +21 -33
  86. package/lib/module/MapRegistry.js.map +1 -1
  87. package/lib/module/NexradRadarLayer.android.js +32 -104
  88. package/lib/module/NexradRadarLayer.android.js.map +1 -1
  89. package/lib/module/NexradRadarLayer.ios.js +30 -101
  90. package/lib/module/NexradRadarLayer.ios.js.map +1 -1
  91. package/lib/module/NexradSitesMapLayer.js +44 -63
  92. package/lib/module/NexradSitesMapLayer.js.map +1 -1
  93. package/lib/module/SatelliteLayer.android.js +32 -44
  94. package/lib/module/SatelliteLayer.android.js.map +1 -1
  95. package/lib/module/SatelliteLayer.ios.js +36 -48
  96. package/lib/module/SatelliteLayer.ios.js.map +1 -1
  97. package/lib/module/StyleApplicator.js +144 -191
  98. package/lib/module/StyleApplicator.js.map +1 -1
  99. package/lib/module/WeatherLayerManager.js +1024 -1675
  100. package/lib/module/WeatherLayerManager.js.map +1 -1
  101. package/lib/module/aguaceroCoreDebugHooks.js +59 -130
  102. package/lib/module/aguaceroCoreDebugHooks.js.map +1 -1
  103. package/lib/module/aguaceroRnDebug.js +151 -292
  104. package/lib/module/aguaceroRnDebug.js.map +1 -1
  105. package/lib/module/cdnAuthenticatedFetch.js +97 -0
  106. package/lib/module/cdnAuthenticatedFetch.js.map +1 -0
  107. package/lib/module/dispatchViewManagerCommandCompat.js +52 -90
  108. package/lib/module/dispatchViewManagerCommandCompat.js.map +1 -1
  109. package/lib/module/gridCdnAuth.js +38 -50
  110. package/lib/module/gridCdnAuth.js.map +1 -1
  111. package/lib/module/index.js +9 -7
  112. package/lib/module/index.js.map +1 -1
  113. package/lib/module/nexrad/nexradAndroidController.js +865 -876
  114. package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
  115. package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +62 -85
  116. package/lib/module/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js.map +1 -1
  117. package/lib/module/nexrad/nexradDiag.js +31 -145
  118. package/lib/module/nexrad/nexradDiag.js.map +1 -1
  119. package/lib/module/nexrad/nexradLevel2Keys.js +245 -0
  120. package/lib/module/nexrad/nexradLevel2Keys.js.map +1 -0
  121. package/lib/module/nexrad/nexradLutBuild.js +64 -110
  122. package/lib/module/nexrad/nexradLutBuild.js.map +1 -1
  123. package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js +136 -163
  124. package/lib/module/nexrad/nexradMapboxFrameOpts.bundled.js.map +1 -1
  125. package/lib/module/nexrad/nexradSdkImports.js +4 -0
  126. package/lib/module/nexrad/nexradSdkImports.js.map +1 -0
  127. package/lib/module/nexrad/radarArchiveCore.bundled.js +2839 -4448
  128. package/lib/module/nexrad/radarArchiveCore.bundled.js.map +1 -1
  129. package/lib/module/nexrad/radarDecode.worker.bundled.js +445 -648
  130. package/lib/module/nexrad/radarDecode.worker.bundled.js.map +1 -1
  131. package/lib/module/nexrad/radarFrameGpuMatch.bundled.js +50 -66
  132. package/lib/module/nexrad/radarFrameGpuMatch.bundled.js.map +1 -1
  133. package/lib/module/nexradNativeCommandIds.js +18 -0
  134. package/lib/module/nexradNativeCommandIds.js.map +1 -0
  135. package/lib/module/nws/NwsAlertsOverlay.android.js +1 -1
  136. package/lib/module/nws/NwsAlertsOverlay.android.js.map +1 -1
  137. package/lib/module/nws/NwsAlertsOverlay.ios.js +1 -1
  138. package/lib/module/nws/NwsAlertsOverlay.ios.js.map +1 -1
  139. package/lib/module/nws/NwsAlertsOverlay.js +5 -5
  140. package/lib/module/nws/NwsAlertsOverlay.js.map +1 -1
  141. package/lib/module/nws/NwsAlertsOverlay.native.js +248 -373
  142. package/lib/module/nws/NwsAlertsOverlay.native.js.map +1 -1
  143. package/lib/module/nws/eventSourceRnPolyfill.js +92 -146
  144. package/lib/module/nws/eventSourceRnPolyfill.js.map +1 -1
  145. package/lib/module/nws/nwsAndroidConstants.js +2 -8
  146. package/lib/module/nws/nwsAndroidConstants.js.map +1 -1
  147. package/lib/module/satellite/satelliteAndroidController.js +123 -208
  148. package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
  149. package/lib/module/satelliteBridgeDiag.js +3 -13
  150. package/lib/module/satelliteBridgeDiag.js.map +1 -1
  151. package/lib/module/satelliteRnDebug.js +123 -223
  152. package/lib/module/satelliteRnDebug.js.map +1 -1
  153. package/lib/typescript/AguaceroContext.d.ts +0 -4
  154. package/lib/typescript/AguaceroContext.d.ts.map +1 -1
  155. package/lib/typescript/GridRenderLayer.d.ts.map +1 -1
  156. package/lib/typescript/MapManager.d.ts +0 -12
  157. package/lib/typescript/MapManager.d.ts.map +1 -1
  158. package/lib/typescript/MapRegistry.d.ts +10 -12
  159. package/lib/typescript/MapRegistry.d.ts.map +1 -1
  160. package/lib/typescript/NexradRadarLayer.android.d.ts.map +1 -1
  161. package/lib/typescript/NexradRadarLayer.ios.d.ts.map +1 -1
  162. package/lib/typescript/NexradSitesMapLayer.d.ts +4 -10
  163. package/lib/typescript/NexradSitesMapLayer.d.ts.map +1 -1
  164. package/lib/typescript/SatelliteLayer.android.d.ts.map +1 -1
  165. package/lib/typescript/SatelliteLayer.ios.d.ts.map +1 -1
  166. package/lib/typescript/StyleApplicator.d.ts +1 -1
  167. package/lib/typescript/StyleApplicator.d.ts.map +1 -1
  168. package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
  169. package/lib/typescript/aguaceroCoreDebugHooks.d.ts +2 -9
  170. package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -1
  171. package/lib/typescript/aguaceroRnDebug.d.ts +47 -66
  172. package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
  173. package/lib/typescript/cdnAuthenticatedFetch.d.ts +10 -0
  174. package/lib/typescript/cdnAuthenticatedFetch.d.ts.map +1 -0
  175. package/lib/typescript/dispatchViewManagerCommandCompat.d.ts +1 -17
  176. package/lib/typescript/dispatchViewManagerCommandCompat.d.ts.map +1 -1
  177. package/lib/typescript/gridCdnAuth.d.ts +16 -21
  178. package/lib/typescript/gridCdnAuth.d.ts.map +1 -1
  179. package/lib/typescript/index.d.ts +1 -0
  180. package/lib/typescript/nexrad/nexradAndroidController.d.ts +39 -89
  181. package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
  182. package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts +2 -1
  183. package/lib/typescript/nexrad/nexradCrossSectionSampleAtLatLon.bundled.d.ts.map +1 -1
  184. package/lib/typescript/nexrad/nexradDiag.d.ts +13 -101
  185. package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
  186. package/lib/typescript/nexrad/nexradLevel2Keys.d.ts +36 -0
  187. package/lib/typescript/nexrad/nexradLevel2Keys.d.ts.map +1 -0
  188. package/lib/typescript/nexrad/nexradLutBuild.d.ts +3 -10
  189. package/lib/typescript/nexrad/nexradLutBuild.d.ts.map +1 -1
  190. package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts +4 -3
  191. package/lib/typescript/nexrad/nexradMapboxFrameOpts.bundled.d.ts.map +1 -1
  192. package/lib/typescript/nexrad/nexradSdkImports.d.ts +2 -0
  193. package/lib/typescript/nexrad/nexradSdkImports.d.ts.map +1 -0
  194. package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts +12 -7
  195. package/lib/typescript/nexrad/radarArchiveCore.bundled.d.ts.map +1 -1
  196. package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts +20 -20
  197. package/lib/typescript/nexrad/radarDecode.worker.bundled.d.ts.map +1 -1
  198. package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts +4 -3
  199. package/lib/typescript/nexrad/radarFrameGpuMatch.bundled.d.ts.map +1 -1
  200. package/lib/typescript/nexradNativeCommandIds.d.ts +2 -0
  201. package/lib/typescript/nexradNativeCommandIds.d.ts.map +1 -0
  202. package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts +6 -17
  203. package/lib/typescript/nws/NwsAlertsOverlay.native.d.ts.map +1 -1
  204. package/lib/typescript/nws/eventSourceRnPolyfill.d.ts +0 -3
  205. package/lib/typescript/nws/eventSourceRnPolyfill.d.ts.map +1 -1
  206. package/lib/typescript/nws/nwsAndroidConstants.d.ts +0 -5
  207. package/lib/typescript/nws/nwsAndroidConstants.d.ts.map +1 -1
  208. package/lib/typescript/satellite/satelliteAndroidController.d.ts +9 -47
  209. package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
  210. package/lib/typescript/satelliteBridgeDiag.d.ts +1 -5
  211. package/lib/typescript/satelliteBridgeDiag.d.ts.map +1 -1
  212. package/lib/typescript/satelliteRnDebug.d.ts +24 -30
  213. package/lib/typescript/satelliteRnDebug.d.ts.map +1 -1
  214. package/package.json +75 -74
  215. package/src/AguaceroContext.js +1 -7
  216. package/src/GridRenderLayer.js +1 -128
  217. package/src/MapManager.js +1 -277
  218. package/src/MapRegistry.js +1 -56
  219. package/src/NexradRadarLayer.android.js +1 -121
  220. package/src/NexradRadarLayer.ios.js +1 -115
  221. package/src/NexradSitesMapLayer.js +1 -75
  222. package/src/SatelliteLayer.android.js +1 -63
  223. package/src/SatelliteLayer.ios.js +1 -70
  224. package/src/StyleApplicator.js +1 -241
  225. package/src/WeatherLayerManager.js +1 -2045
  226. package/src/aguaceroCoreDebugHooks.js +1 -142
  227. package/src/aguaceroRnDebug.js +1 -336
  228. package/src/cdnAuthenticatedFetch.js +1 -0
  229. package/src/dispatchViewManagerCommandCompat.js +1 -100
  230. package/src/gridCdnAuth.js +1 -56
  231. package/src/index.js +1 -27
  232. package/src/nexrad/nexradAndroidController.js +1 -1078
  233. package/src/nexrad/nexradCrossSectionSampleAtLatLon.bundled.js +1 -91
  234. package/src/nexrad/nexradDiag.js +1 -150
  235. package/src/nexrad/nexradLevel2Keys.js +1 -0
  236. package/src/nexrad/nexradLutBuild.js +1 -126
  237. package/src/nexrad/nexradMapboxFrameOpts.bundled.js +1 -245
  238. package/src/nexrad/nexradSdkImports.js +1 -0
  239. package/src/nexrad/radarArchiveCore.bundled.js +1 -7085
  240. package/src/nexrad/radarDecode.worker.bundled.js +1 -813
  241. package/src/nexrad/radarFrameGpuMatch.bundled.js +1 -79
  242. package/src/nexradNativeCommandIds.js +1 -0
  243. package/src/nws/NwsAlertsOverlay.android.js +1 -1
  244. package/src/nws/NwsAlertsOverlay.ios.js +1 -1
  245. package/src/nws/NwsAlertsOverlay.js +1 -7
  246. package/src/nws/NwsAlertsOverlay.native.js +1 -463
  247. package/src/nws/eventSourceRnPolyfill.js +7 -193
  248. package/src/nws/nwsAndroidConstants.js +1 -8
  249. package/src/satellite/satelliteAndroidController.js +1 -257
  250. package/src/satelliteBridgeDiag.js +1 -15
  251. package/src/satelliteRnDebug.js +1 -269
  252. package/lib/commonjs/nexrad/nexradNativeCommandIds.js +0 -51
  253. package/lib/commonjs/nexrad/nexradNativeCommandIds.js.map +0 -1
  254. package/lib/module/nexrad/nexradNativeCommandIds.js +0 -44
  255. package/lib/module/nexrad/nexradNativeCommandIds.js.map +0 -1
  256. package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts +0 -9
  257. package/lib/typescript/nexrad/nexradNativeCommandIds.d.ts.map +0 -1
  258. package/src/nexrad/nexradNativeCommandIds.js +0 -44
  259. /package/lib/commonjs/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
  260. /package/lib/module/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
  261. /package/src/{nexrad/nexradSitesUs.json → nexradSitesUs.json} +0 -0
@@ -1,128 +1 @@
1
- // packages/react-native/src/GridRenderLayer.js
2
-
3
- import React, { useRef, useImperativeHandle, forwardRef } from 'react';
4
- import { UIManager, findNodeHandle, StyleSheet } from 'react-native';
5
- import GridRenderView from './GridRenderLayerNativeComponent';
6
-
7
- const NATIVE_COMPONENT_NAME = 'GridRenderLayer';
8
-
9
- export const GridRenderLayer = forwardRef((props, ref) => {
10
- const nativeRef = useRef(null);
11
-
12
- const getCommandId = (commandName) => {
13
- try {
14
- const config = UIManager.getViewManagerConfig(NATIVE_COMPONENT_NAME);
15
- return config?.Commands?.[commandName] ?? null;
16
- } catch {
17
- return null;
18
- }
19
- };
20
-
21
- useImperativeHandle(ref, () => ({
22
- updateGeometry: (corners, gridDef) => {
23
- if (!nativeRef.current) return;
24
- const commandId = getCommandId('updateGeometry');
25
- if (commandId == null) return;
26
- const handle = findNodeHandle(nativeRef.current);
27
- UIManager.dispatchViewManagerCommand(handle, commandId, [corners, gridDef]);
28
- },
29
-
30
- setVariable: (variableName) => {
31
- if (!nativeRef.current) return;
32
- const commandId = getCommandId('setVariable');
33
- if (commandId == null) return;
34
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), commandId, [variableName]);
35
- },
36
-
37
- updateDataTextureFromFile: (filePath, nx, ny, scale, offset, missing, scaleType) => {
38
- if (!nativeRef.current) return;
39
- const commandId = getCommandId('updateDataTexture');
40
- if (commandId == null) return;
41
- UIManager.dispatchViewManagerCommand(
42
- findNodeHandle(nativeRef.current),
43
- commandId,
44
- [filePath, Number(nx), Number(ny), Number(scale), Number(offset), Number(missing), scaleType || 'linear'],
45
- );
46
- },
47
-
48
- updateDataTexture: (base64Data, nx, ny, scale, offset, missing, scaleType) => {
49
- if (!nativeRef.current) return;
50
- const commandId = getCommandId('updateDataTexture');
51
- if (commandId == null) return;
52
- UIManager.dispatchViewManagerCommand(
53
- findNodeHandle(nativeRef.current),
54
- commandId,
55
- [base64Data, Number(nx), Number(ny), Number(scale), Number(offset), Number(missing), scaleType || 'linear'],
56
- );
57
- },
58
-
59
- updateColormapTexture: (colormapArray) => {
60
- if (!nativeRef.current) return;
61
- const commandId = getCommandId('updateColormapTexture');
62
- if (commandId == null) return;
63
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), commandId, [colormapArray]);
64
- },
65
-
66
- updateDataParameters: (scale, offset, missing, scaleType) => {
67
- if (!nativeRef.current) return;
68
- const commandId = getCommandId('updateDataParameters');
69
- if (commandId == null) return;
70
- UIManager.dispatchViewManagerCommand(
71
- findNodeHandle(nativeRef.current),
72
- commandId,
73
- [Number(scale), Number(offset), Number(missing), Number(scaleType)],
74
- );
75
- },
76
-
77
- setSmoothing: (enabled) => {
78
- if (!nativeRef.current) return;
79
- nativeRef.current.setNativeProps({ smoothing: enabled });
80
- },
81
-
82
- clear: () => {
83
- if (!nativeRef.current) return;
84
- const commandId = getCommandId('clear');
85
- if (commandId == null) return;
86
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), commandId, []);
87
- },
88
-
89
- primeGpuCache: (frameInfo) => {
90
- if (!nativeRef.current) return;
91
- const commandId = getCommandId('primeGpuCache');
92
- if (commandId == null) return;
93
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), commandId, [frameInfo]);
94
- },
95
-
96
- setActiveFrame: (cacheKey) => {
97
- if (!nativeRef.current) return;
98
- const commandId = getCommandId('setActiveFrame');
99
- if (commandId == null) return;
100
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), commandId, [cacheKey]);
101
- },
102
-
103
- clearGpuCache: () => {
104
- if (!nativeRef.current) return;
105
- const commandId = getCommandId('clearGpuCache');
106
- if (commandId == null) return;
107
- UIManager.dispatchViewManagerCommand(findNodeHandle(nativeRef.current), commandId, []);
108
- },
109
- }));
110
-
111
- return (
112
- <GridRenderView
113
- ref={nativeRef}
114
- opacity={props.opacity}
115
- dataRange={props.dataRange}
116
- belowID={props.belowID}
117
- smoothing={true}
118
- style={styles.overlay}
119
- pointerEvents="none"
120
- />
121
- );
122
- });
123
-
124
- const styles = StyleSheet.create({
125
- overlay: {
126
- ...StyleSheet.absoluteFillObject,
127
- },
128
- });
1
+ import f,{useRef as g,useImperativeHandle as h,forwardRef as C}from"react";import{UIManager as a,findNodeHandle as u,StyleSheet as p}from"react-native";import N from"./GridRenderLayerNativeComponent";const w="GridRenderLayer";export const GridRenderLayer=C((l,b)=>{const r=g(null),n=e=>{try{return a.getViewManagerConfig(w)?.Commands?.[e]??null}catch{return null}};return h(b,()=>({updateGeometry:(e,t)=>{if(!r.current)return;const c=n("updateGeometry");if(c==null)return;const o=u(r.current);a.dispatchViewManagerCommand(o,c,[e,t])},setVariable:e=>{if(!r.current)return;const t=n("setVariable");t!=null&&a.dispatchViewManagerCommand(u(r.current),t,[e])},updateDataTextureFromFile:(e,t,c,o,m,s,d)=>{if(!r.current)return;const i=n("updateDataTexture");i!=null&&a.dispatchViewManagerCommand(u(r.current),i,[e,Number(t),Number(c),Number(o),Number(m),Number(s),d||"linear"])},updateDataTexture:(e,t,c,o,m,s,d)=>{if(!r.current)return;const i=n("updateDataTexture");i!=null&&a.dispatchViewManagerCommand(u(r.current),i,[e,Number(t),Number(c),Number(o),Number(m),Number(s),d||"linear"])},updateColormapTexture:e=>{if(!r.current)return;const t=n("updateColormapTexture");t!=null&&a.dispatchViewManagerCommand(u(r.current),t,[e])},updateDataParameters:(e,t,c,o)=>{if(!r.current)return;const m=n("updateDataParameters");m!=null&&a.dispatchViewManagerCommand(u(r.current),m,[Number(e),Number(t),Number(c),Number(o)])},setSmoothing:e=>{r.current&&r.current.setNativeProps({smoothing:e})},clear:()=>{if(!r.current)return;const e=n("clear");e!=null&&a.dispatchViewManagerCommand(u(r.current),e,[])},primeGpuCache:e=>{if(!r.current)return;const t=n("primeGpuCache");t!=null&&a.dispatchViewManagerCommand(u(r.current),t,[e])},setActiveFrame:e=>{if(!r.current)return;const t=n("setActiveFrame");t!=null&&a.dispatchViewManagerCommand(u(r.current),t,[e])},clearGpuCache:()=>{if(!r.current)return;const e=n("clearGpuCache");e!=null&&a.dispatchViewManagerCommand(u(r.current),e,[])}})),f.createElement(N,{ref:r,opacity:l.opacity,dataRange:l.dataRange,belowID:l.belowID,smoothing:!0,style:V.overlay,pointerEvents:"none"})});const V=p.create({overlay:{...p.absoluteFillObject}});
package/src/MapManager.js CHANGED
@@ -1,277 +1 @@
1
- // packages/react-native/src/MapManager.js
2
-
3
- import React, { useMemo, useEffect, useState, useRef, forwardRef, useImperativeHandle } from 'react';
4
- import { View, StyleSheet, Text } from 'react-native';
5
- import Mapbox from '@rnmapbox/maps';
6
- import { THEME_CONFIGS } from '@aguacerowx/javascript-sdk';
7
- import { StyleApplicator } from './StyleApplicator';
8
- import { AguaceroContext } from './AguaceroContext';
9
- import { mapRegistry } from './MapRegistry';
10
-
11
- const BASE_STYLE_URL = 'mapbox://styles/aguacerowx/cmfvox8mq004u01qm5nlg7qkt';
12
-
13
- // --- UTILITIES ---
14
- function isObject(item) {
15
- return (item && typeof item === 'object' && !Array.isArray(item));
16
- }
17
-
18
- function deepMerge(target, source) {
19
- const output = { ...target };
20
- if (isObject(target) && isObject(source)) {
21
- Object.keys(source).forEach(key => {
22
- if (isObject(source[key])) {
23
- if (!(key in target)) {
24
- Object.assign(output, { [key]: source[key] });
25
- } else {
26
- output[key] = deepMerge(target[key], source[key]);
27
- }
28
- } else {
29
- Object.assign(output, { [key]: source[key] });
30
- }
31
- });
32
- }
33
- return output;
34
- }
35
-
36
- /**
37
- * @param {object} props
38
- * @param {string} props.mapboxToken
39
- * @param {object} [props.customStyles]
40
- * @param {'light'|'dark'} [props.theme]
41
- * @param {object} [props.mapOptions] - `style` / `styleURL` / `styleUrl` set the map style when no top-level custom style pair is used (mapsgl parity).
42
- * @param {string} [props.styleURL] - Custom Mapbox style URL (alias: `styleUrl`).
43
- * @param {string} [props.styleUrl]
44
- * @param {string} [props.belowID] - Style layer id to insert Aguacero weather **below** (alias: `weatherBeforeLayerId`). With `styleURL`, required for correct stacking; may be set alone to override the default `AML_-_terrain` anchor on the default style.
45
- * @param {string} [props.weatherBeforeLayerId]
46
- * @param {import('react').ReactNode} [props.children] - Render inside Mapbox.MapView; use for WeatherLayerManager so map sources (e.g. NEXRAD site circles) register on the map.
47
- */
48
- export const MapManager = forwardRef(({
49
- mapboxToken,
50
- customStyles,
51
- theme = 'light',
52
- mapOptions = {},
53
- styleURL: styleURLProp,
54
- styleUrl: styleUrlProp,
55
- belowID: belowIDProp,
56
- weatherBeforeLayerId: weatherBeforeLayerIdProp,
57
- children,
58
- }, ref) => {
59
- const mapRef = useRef(null);
60
- const cameraRef = useRef(null);
61
- const [mapStyle, setMapStyle] = useState(null);
62
-
63
- const { resolvedStyleURL, weatherBeforeLayerId } = useMemo(() => {
64
- const mo = mapOptions || {};
65
- let resolved = BASE_STYLE_URL;
66
- if (mo.style !== undefined) {
67
- resolved = mo.style;
68
- } else if (mo.styleURL !== undefined) {
69
- resolved = mo.styleURL;
70
- } else if (mo.styleUrl !== undefined) {
71
- resolved = mo.styleUrl;
72
- }
73
-
74
- let anchor = null;
75
- const customStyleUrl = styleURLProp || styleUrlProp;
76
- const customBeforeId = belowIDProp || weatherBeforeLayerIdProp;
77
- if (customStyleUrl) {
78
- if (customBeforeId && String(customBeforeId).trim()) {
79
- resolved = customStyleUrl;
80
- anchor = String(customBeforeId).trim();
81
- } else if (mo.style === undefined && mo.styleURL === undefined && mo.styleUrl === undefined) {
82
- resolved = BASE_STYLE_URL;
83
- }
84
- } else if (customBeforeId && String(customBeforeId).trim()) {
85
- anchor = String(customBeforeId).trim();
86
- }
87
-
88
- return { resolvedStyleURL: resolved, weatherBeforeLayerId: anchor };
89
- }, [mapOptions, styleURLProp, styleUrlProp, belowIDProp, weatherBeforeLayerIdProp]);
90
-
91
- // Expose camera and map methods via ref
92
- useImperativeHandle(ref, () => ({
93
- // Camera methods
94
- flyTo: (config) => {
95
- if (cameraRef.current) {
96
- cameraRef.current.flyTo(config);
97
- }
98
- },
99
- moveTo: (config) => {
100
- if (cameraRef.current) {
101
- cameraRef.current.moveTo(config);
102
- }
103
- },
104
- zoomTo: (zoomLevel, duration = 2000) => {
105
- if (cameraRef.current) {
106
- cameraRef.current.zoomTo(zoomLevel, duration);
107
- }
108
- },
109
- setCamera: (config) => {
110
- if (cameraRef.current) {
111
- cameraRef.current.setCamera(config);
112
- }
113
- },
114
-
115
- // Map methods
116
- getCenter: async () => {
117
- if (mapRef.current) {
118
- return await mapRef.current.getCenter();
119
- }
120
- return null;
121
- },
122
- getZoom: async () => {
123
- if (mapRef.current) {
124
- return await mapRef.current.getZoom();
125
- }
126
- return null;
127
- },
128
- getCoordinateFromView: async (point) => {
129
- if (mapRef.current) {
130
- return await mapRef.current.getCoordinateFromView(point);
131
- }
132
- return null;
133
- },
134
- getPointInView: async (coordinate) => {
135
- if (mapRef.current) {
136
- return await mapRef.current.getPointInView(coordinate);
137
- }
138
- return null;
139
- },
140
- queryRenderedFeaturesAtPoint: async (point, filter, layerIds) => {
141
- if (mapRef.current) {
142
- return await mapRef.current.queryRenderedFeaturesAtPoint(point, filter, layerIds);
143
- }
144
- return null;
145
- },
146
-
147
- // Direct access to refs (for advanced use cases)
148
- getMapRef: () => mapRef.current,
149
- getCameraRef: () => cameraRef.current,
150
- }), []);
151
-
152
- // Register map with the global registry when it's ready
153
- useEffect(() => {
154
- if (mapRef.current) {
155
- mapRegistry.setMap(mapRef.current);
156
- }
157
- }, []);
158
-
159
- const contextValue = useMemo(() => ({
160
- getMap: () => mapRef.current,
161
- getCenter: () => {
162
- return mapRef.current?._currentCenter || [-95.7129, 37.0902];
163
- },
164
- /** @type {string | null} Null with default Aguacero style — use `AML_-_terrain` for weather insert (see WeatherLayerManager). */
165
- weatherBeforeLayerId,
166
- resolvedStyleURL,
167
- }), [weatherBeforeLayerId, resolvedStyleURL]);
168
-
169
- useEffect(() => {
170
- let lightTheme = JSON.parse(JSON.stringify(THEME_CONFIGS.light));
171
- let darkTheme = JSON.parse(JSON.stringify(THEME_CONFIGS.dark));
172
-
173
- if (customStyles) {
174
- if (customStyles.light) {
175
- lightTheme = deepMerge(lightTheme, customStyles.light);
176
- }
177
- if (customStyles.dark) {
178
- darkTheme = deepMerge(darkTheme, customStyles.dark);
179
- }
180
- }
181
-
182
- setMapStyle(theme === 'dark' ? darkTheme : lightTheme);
183
- }, [customStyles, theme]);
184
-
185
- useEffect(() => {
186
- if (mapboxToken) {
187
- Mapbox.setAccessToken(mapboxToken);
188
- }
189
- }, [mapboxToken]);
190
-
191
- if (!mapboxToken) {
192
- return (
193
- <View style={[styles.container, styles.centerContent]}>
194
- <Text style={styles.errorText}>Mapbox Token Missing</Text>
195
- <Text style={styles.errorSubText}>Please provide the 'mapboxToken' prop.</Text>
196
- </View>
197
- );
198
- }
199
-
200
- const handleCameraChange = (event) => {
201
- if (event?.properties?.center) {
202
- const center = event.properties.center;
203
-
204
- // Store the current center in the ref for immediate access
205
- if (mapRef.current) {
206
- mapRef.current._currentCenter = center;
207
- }
208
-
209
- mapRegistry.notifyCameraChange(center);
210
- }
211
- };
212
-
213
- const handleMapPress = (payload) => {
214
- mapRegistry.notifyMapPress(payload);
215
- };
216
-
217
- return (
218
- <View style={styles.container}>
219
- <AguaceroContext.Provider value={contextValue}>
220
- <Mapbox.MapView
221
- ref={mapRef}
222
- style={styles.map}
223
- styleURL={resolvedStyleURL}
224
- scaleBarEnabled={false}
225
- onCameraChanged={handleCameraChange}
226
- onPress={handleMapPress}
227
- >
228
- <Mapbox.Camera
229
- ref={cameraRef}
230
- defaultSettings={{
231
- centerCoordinate: mapOptions.center || [-15.7129, 37.0902],
232
- zoomLevel: mapOptions.zoom || 0,
233
- pitch: mapOptions.pitch || 0,
234
- bearing: mapOptions.bearing || 0,
235
- minZoomLevel: mapOptions.minZoom || 2,
236
- maxZoomLevel: mapOptions.maxZoom || 12,
237
- }}
238
- />
239
-
240
- {mapStyle && <StyleApplicator styles={mapStyle} />}
241
-
242
- <Mapbox.VectorSource id="mapbox-dem" url="mapbox://mapbox.mapbox-terrain-dem-v1"/>
243
- {children}
244
- </Mapbox.MapView>
245
- </AguaceroContext.Provider>
246
- </View>
247
- );
248
- });
249
-
250
- const styles = StyleSheet.create({
251
- /**
252
- * Full-bleed positioning so RNMapbox/Mapbox gets non-zero bounds on the first layout pass.
253
- * A plain flex:1 sibling tree (e.g. map + absolute overlays under Expo Tabs) can still yield
254
- * a transient 0×0 MapView, which triggers maps-core "Invalid size … fall back to {64, 64}".
255
- */
256
- container: {
257
- ...StyleSheet.absoluteFillObject,
258
- backgroundColor: '#1a1a2e',
259
- },
260
- centerContent: {
261
- justifyContent: 'center',
262
- alignItems: 'center',
263
- },
264
- map: {
265
- ...StyleSheet.absoluteFillObject,
266
- },
267
- errorText: {
268
- color: '#FF6B6B',
269
- fontSize: 22,
270
- fontWeight: 'bold',
271
- },
272
- errorSubText: {
273
- color: 'white',
274
- fontSize: 16,
275
- marginTop: 8,
276
- }
277
- });
1
+ import l,{useMemo as E,useEffect as g,useState as V,useRef as R,forwardRef as z,useImperativeHandle as Z}from"react";import{View as U,StyleSheet as f,Text as M}from"react-native";import y from"@rnmapbox/maps";import{THEME_CONFIGS as k}from"@aguacerowx/javascript-sdk";import{StyleApplicator as q}from"./StyleApplicator";import{AguaceroContext as N}from"./AguaceroContext";import{mapRegistry as d}from"./MapRegistry";const O="mapbox://styles/aguacerowx/cmfvox8mq004u01qm5nlg7qkt";function b(o){return o&&typeof o=="object"&&!Array.isArray(o)}function C(o,a){const c={...o};return b(o)&&b(a)&&Object.keys(a).forEach(t=>{b(a[t])?t in o?c[t]=C(o[t],a[t]):Object.assign(c,{[t]:a[t]}):Object.assign(c,{[t]:a[t]})}),c}export const MapManager=z(({mapboxToken:o,customStyles:a,theme:c="light",mapOptions:t={},styleURL:S,styleUrl:v,belowID:h,weatherBeforeLayerId:w,children:F},I)=>{const r=R(null),s=R(null),[x,P]=V(null),{resolvedStyleURL:p,weatherBeforeLayerId:T}=E(()=>{const e=t||{};let n=O;e.style!==void 0?n=e.style:e.styleURL!==void 0?n=e.styleURL:e.styleUrl!==void 0&&(n=e.styleUrl);let u=null;const L=S||v,i=h||w;return L?i&&String(i).trim()?(n=L,u=String(i).trim()):e.style===void 0&&e.styleURL===void 0&&e.styleUrl===void 0&&(n=O):i&&String(i).trim()&&(u=String(i).trim()),{resolvedStyleURL:n,weatherBeforeLayerId:u}},[t,S,v,h,w]);Z(I,()=>({flyTo:e=>{s.current&&s.current.flyTo(e)},moveTo:e=>{s.current&&s.current.moveTo(e)},zoomTo:(e,n=2e3)=>{s.current&&s.current.zoomTo(e,n)},setCamera:e=>{s.current&&s.current.setCamera(e)},getCenter:async()=>r.current?await r.current.getCenter():null,getZoom:async()=>r.current?await r.current.getZoom():null,getCoordinateFromView:async e=>r.current?await r.current.getCoordinateFromView(e):null,getPointInView:async e=>r.current?await r.current.getPointInView(e):null,queryRenderedFeaturesAtPoint:async(e,n,u)=>r.current?await r.current.queryRenderedFeaturesAtPoint(e,n,u):null,getMapRef:()=>r.current,getCameraRef:()=>s.current}),[]),g(()=>{r.current&&d.setMap(r.current)},[]);const j=E(()=>({getMap:()=>r.current,getCenter:()=>r.current?._currentCenter||[-95.7129,37.0902],weatherBeforeLayerId:T,resolvedStyleURL:p}),[T,p]);if(g(()=>{let e=JSON.parse(JSON.stringify(k.light)),n=JSON.parse(JSON.stringify(k.dark));a&&(a.light&&(e=C(e,a.light)),a.dark&&(n=C(n,a.dark))),P(c==="dark"?n:e)},[a,c]),g(()=>{o&&y.setAccessToken(o)},[o]),!o)return l.createElement(U,{style:[m.container,m.centerContent]},l.createElement(M,{style:m.errorText},"Mapbox Token Missing"),l.createElement(M,{style:m.errorSubText},"Please provide the 'mapboxToken' prop."));const A=e=>{if(e?.properties?.center){const n=e.properties.center;r.current&&(r.current._currentCenter=n),d.notifyCameraChange(n)}},B=e=>{d.notifyMapPress(e)};return l.createElement(U,{style:m.container},l.createElement(N.Provider,{value:j},l.createElement(y.MapView,{ref:r,style:m.map,styleURL:p,scaleBarEnabled:!1,onCameraChanged:A,onPress:B},l.createElement(y.Camera,{ref:s,defaultSettings:{centerCoordinate:t.center||[-15.7129,37.0902],zoomLevel:t.zoom||0,pitch:t.pitch||0,bearing:t.bearing||0,minZoomLevel:t.minZoom||2,maxZoomLevel:t.maxZoom||12}}),x&&l.createElement(q,{styles:x}),l.createElement(y.VectorSource,{id:"mapbox-dem",url:"mapbox://mapbox.mapbox-terrain-dem-v1"}),F)))});const m=f.create({container:{...f.absoluteFillObject,backgroundColor:"#1a1a2e"},centerContent:{justifyContent:"center",alignItems:"center"},map:{...f.absoluteFillObject},errorText:{color:"#FF6B6B",fontSize:22,fontWeight:"bold"},errorSubText:{color:"white",fontSize:16,marginTop:8}});
@@ -1,56 +1 @@
1
- // Simple registry to share the map instance
2
- class MapRegistry {
3
- constructor() {
4
- this.mapRef = null;
5
- this.listeners = [];
6
- /** @type {((payload: unknown) => void)[]} */
7
- this.pressListeners = [];
8
- }
9
-
10
- setMap(mapRef) {
11
- this.mapRef = mapRef;
12
- }
13
-
14
- getMap() {
15
- return this.mapRef;
16
- }
17
-
18
- addCameraListener(listener) {
19
- this.listeners.push(listener);
20
- }
21
-
22
- removeCameraListener(listener) {
23
- const index = this.listeners.indexOf(listener);
24
- if (index > -1) {
25
- this.listeners.splice(index, 1);
26
- }
27
- }
28
-
29
- notifyCameraChange(center) {
30
- this.listeners.forEach(listener => listener(center));
31
- }
32
-
33
- addPressListener(listener) {
34
- this.pressListeners.push(listener);
35
- }
36
-
37
- removePressListener(listener) {
38
- const index = this.pressListeners.indexOf(listener);
39
- if (index > -1) {
40
- this.pressListeners.splice(index, 1);
41
- }
42
- }
43
-
44
- /** @param {unknown} payload - `@rnmapbox/maps` map press payload */
45
- notifyMapPress(payload) {
46
- this.pressListeners.forEach((listener) => {
47
- try {
48
- listener(payload);
49
- } catch {
50
- /* ignore */
51
- }
52
- });
53
- }
54
- }
55
-
56
- export const mapRegistry = new MapRegistry();
1
+ class t{constructor(){this.mapRef=null,this.listeners=[],this.pressListeners=[]}setMap(s){this.mapRef=s}getMap(){return this.mapRef}addCameraListener(s){this.listeners.push(s)}removeCameraListener(s){const e=this.listeners.indexOf(s);e>-1&&this.listeners.splice(e,1)}notifyCameraChange(s){this.listeners.forEach(e=>e(s))}addPressListener(s){this.pressListeners.push(s)}removePressListener(s){const e=this.pressListeners.indexOf(s);e>-1&&this.pressListeners.splice(e,1)}notifyMapPress(s){this.pressListeners.forEach(e=>{try{e(s)}catch{}})}}export const mapRegistry=new t;
@@ -1,121 +1 @@
1
- import React, { forwardRef, useImperativeHandle, useRef } from 'react';
2
- import { StyleSheet, UIManager, findNodeHandle } from 'react-native';
3
- import NexradRadarLayerNative from './NexradRadarLayerNativeComponent';
4
- import { nexradDiag, nexradPerfSpan } from './nexrad/nexradDiag';
5
- import { resolveNexradCommandId } from './nexrad/nexradNativeCommandIds';
6
-
7
- const NATIVE_COMPONENT_NAME = 'NexradRadarLayer';
8
-
9
- function getCommandId(commandName) {
10
- return resolveNexradCommandId(commandName);
11
- }
12
-
13
- export const NexradRadarLayer = forwardRef((props, ref) => {
14
- const nativeRef = useRef(null);
15
-
16
- useImperativeHandle(ref, () => ({
17
- uploadNexradFrame(json) {
18
- const bridge = nexradPerfSpan('bridge.dispatchViewManagerCommand.uploadNexradFrame');
19
- const id = getCommandId('uploadNexradFrame');
20
- const handle = findNodeHandle(nativeRef.current);
21
- if (id != null && handle != null) {
22
- UIManager.dispatchViewManagerCommand(handle, id, [json]);
23
- bridge.end({
24
- jsonChars: typeof json === 'string' ? json.length : 0,
25
- ok: true,
26
- });
27
- } else {
28
- bridge.end({
29
- jsonChars: typeof json === 'string' ? json.length : 0,
30
- ok: false,
31
- commandId: id,
32
- hasHandle: handle != null,
33
- hasRef: nativeRef.current != null,
34
- });
35
- nexradDiag('bridge.uploadNexradFrameBlocked', {
36
- commandId: id,
37
- hasHandle: handle != null,
38
- hasRef: nativeRef.current != null,
39
- });
40
- }
41
- },
42
- uploadNexradStyleOnly(json) {
43
- const bridge = nexradPerfSpan('bridge.dispatchViewManagerCommand.uploadNexradStyleOnly');
44
- const id = getCommandId('uploadNexradStyleOnly');
45
- const handle = findNodeHandle(nativeRef.current);
46
- if (id != null && handle != null) {
47
- UIManager.dispatchViewManagerCommand(handle, id, [json]);
48
- bridge.end({
49
- jsonChars: typeof json === 'string' ? json.length : 0,
50
- ok: true,
51
- });
52
- } else {
53
- bridge.end({
54
- jsonChars: typeof json === 'string' ? json.length : 0,
55
- ok: false,
56
- commandId: id,
57
- hasHandle: handle != null,
58
- });
59
- nexradDiag('bridge.uploadNexradStyleOnlyBlocked', {
60
- commandId: id,
61
- hasHandle: handle != null,
62
- });
63
- }
64
- },
65
- clearNexrad() {
66
- const bridge = nexradPerfSpan('bridge.dispatchViewManagerCommand.clearNexrad');
67
- const id = getCommandId('clearNexrad');
68
- const handle = findNodeHandle(nativeRef.current);
69
- if (id != null && handle != null) {
70
- UIManager.dispatchViewManagerCommand(handle, id, []);
71
- bridge.end({ ok: true });
72
- } else {
73
- bridge.end({ ok: false, commandId: id, hasHandle: handle != null });
74
- }
75
- },
76
- activateNexradCachedFrame(nativeGpuCacheKey) {
77
- const bridge = nexradPerfSpan('bridge.dispatchViewManagerCommand.activateNexradCachedFrame');
78
- const id = getCommandId('activateNexradCachedFrame');
79
- const handle = findNodeHandle(nativeRef.current);
80
- if (id != null && handle != null && typeof nativeGpuCacheKey === 'string') {
81
- UIManager.dispatchViewManagerCommand(handle, id, [nativeGpuCacheKey]);
82
- bridge.end({
83
- keyLen: nativeGpuCacheKey.length,
84
- ok: true,
85
- });
86
- } else {
87
- bridge.end({
88
- keyLen: typeof nativeGpuCacheKey === 'string' ? nativeGpuCacheKey.length : 0,
89
- ok: false,
90
- commandId: id,
91
- hasHandle: handle != null,
92
- });
93
- nexradDiag('bridge.activateNexradCachedFrameBlocked', {
94
- commandId: id,
95
- hasHandle: handle != null,
96
- keyType: typeof nativeGpuCacheKey,
97
- });
98
- }
99
- },
100
- }));
101
-
102
- return (
103
- <NexradRadarLayerNative
104
- ref={nativeRef}
105
- belowID={props.belowID}
106
- style={styles.overlay}
107
- pointerEvents="none"
108
- collapsable={false}
109
- />
110
- );
111
- });
112
-
113
- const styles = StyleSheet.create({
114
- overlay: {
115
- ...StyleSheet.absoluteFillObject,
116
- },
117
- });
118
-
119
- NexradRadarLayer.displayName = 'NexradRadarLayer';
120
-
121
- export default NexradRadarLayer;
1
+ import n,{forwardRef as s,useImperativeHandle as c,useRef as m}from"react";import{StyleSheet as t,UIManager as u,findNodeHandle as p}from"react-native";import i from"./NexradRadarLayerNativeComponent";import{resolveNexradCommandId as x}from"./nexradNativeCommandIds";const N="NexradRadarLayer";function l(r,o,a=[]){const e=x(o),d=p(r.current);return e!=null&&d!=null?(u.dispatchViewManagerCommand(d,e,a),!0):(__DEV__&&console.warn(`[Aguacero][NexradRadarLayer] ${o} blocked`,{commandId:e,hasHandle:d!=null,hasRef:r.current!=null,component:N}),!1)}export const NexradRadarLayer=s((r,o)=>{const a=m(null);return c(o,()=>({uploadNexradFrame(e){l(a,"uploadNexradFrame",[e])},uploadNexradStyleOnly(e){l(a,"uploadNexradStyleOnly",[e])},clearNexrad(){l(a,"clearNexrad",[])},activateNexradCachedFrame(e){typeof e=="string"&&l(a,"activateNexradCachedFrame",[e])}})),n.createElement(i,{ref:a,belowID:r.belowID,style:f.overlay,pointerEvents:"none",collapsable:!1})});const f=t.create({overlay:{...t.absoluteFillObject}});NexradRadarLayer.displayName="NexradRadarLayer";export default NexradRadarLayer;