react-native-maplibre-gl-js 1.3.0 → 1.3.1

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 (79) hide show
  1. package/lib/module/react-native/components/Map/{Map.test.js → Map.test.unit.js} +1 -1
  2. package/lib/module/react-native/components/Map/Map.test.unit.js.map +1 -0
  3. package/lib/module/react-native/components/MapProvider/{MapProvider.test.js → MapProvider.test.unit.js} +3 -1
  4. package/lib/module/react-native/components/MapProvider/MapProvider.test.unit.js.map +1 -0
  5. package/lib/module/react-native/components/Marker/{Marker.test.js → Marker.test.unit.js} +2 -1
  6. package/lib/module/react-native/components/Marker/Marker.test.unit.js.map +1 -0
  7. package/lib/module/react-native/components/Popup/{Popup.test.js → Popup.test.unit.js} +1 -1
  8. package/lib/module/react-native/components/Popup/Popup.test.unit.js.map +1 -0
  9. package/lib/module/react-native/components-factory/createWebObjectAsComponent.js +5 -13
  10. package/lib/module/react-native/components-factory/createWebObjectAsComponent.js.map +1 -1
  11. package/lib/module/react-native/components-factory/createWebObjectAsComponent.test.integration.js +85 -0
  12. package/lib/module/react-native/components-factory/createWebObjectAsComponent.test.integration.js.map +1 -0
  13. package/lib/module/react-native/components-factory/createWebObjectAsComponent.test.unit.js +30 -0
  14. package/lib/module/react-native/components-factory/createWebObjectAsComponent.test.unit.js.map +1 -0
  15. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.js +2 -9
  16. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.js.map +1 -1
  17. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.mock.js +10 -0
  18. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.mock.js.map +1 -0
  19. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.js +57 -0
  20. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.js.map +1 -0
  21. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.mock.js +5 -0
  22. package/lib/module/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.mock.js.map +1 -0
  23. package/lib/module/react-native/hooks/atoms/useMapAtoms.mock.js +5 -0
  24. package/lib/module/react-native/hooks/atoms/useMapAtoms.mock.js.map +1 -1
  25. package/lib/typescript/src/react-native/components/Map/Map.test.unit.d.ts +2 -0
  26. package/lib/typescript/src/react-native/components/Map/Map.test.unit.d.ts.map +1 -0
  27. package/lib/typescript/src/react-native/components/MapProvider/MapProvider.test.unit.d.ts +2 -0
  28. package/lib/typescript/src/react-native/components/MapProvider/MapProvider.test.unit.d.ts.map +1 -0
  29. package/lib/typescript/src/react-native/components/Marker/Marker.test.unit.d.ts +2 -0
  30. package/lib/typescript/src/react-native/components/Marker/Marker.test.unit.d.ts.map +1 -0
  31. package/lib/typescript/src/react-native/components/Popup/Popup.test.unit.d.ts +2 -0
  32. package/lib/typescript/src/react-native/components/Popup/Popup.test.unit.d.ts.map +1 -0
  33. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.d.ts.map +1 -1
  34. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.test.integration.d.ts +2 -0
  35. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.test.integration.d.ts.map +1 -0
  36. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.test.unit.d.ts +2 -0
  37. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.test.unit.d.ts.map +1 -0
  38. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.d.ts.map +1 -1
  39. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.mock.d.ts +9 -0
  40. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.mock.d.ts.map +1 -0
  41. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.d.ts +14 -0
  42. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.d.ts.map +1 -0
  43. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.mock.d.ts +3 -0
  44. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.mock.d.ts.map +1 -0
  45. package/lib/typescript/src/react-native/hooks/atoms/useMapAtoms.mock.d.ts +2 -0
  46. package/lib/typescript/src/react-native/hooks/atoms/useMapAtoms.mock.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/lib/module/react-native/components/Map/Map.test.js.map +0 -1
  49. package/lib/module/react-native/components/MapProvider/MapProvider.test.js.map +0 -1
  50. package/lib/module/react-native/components/Marker/Marker.test.js.map +0 -1
  51. package/lib/module/react-native/components/Popup/Popup.test.js.map +0 -1
  52. package/lib/module/react-native/components-factory/createWebObjectAsComponent.test.js +0 -28
  53. package/lib/module/react-native/components-factory/createWebObjectAsComponent.test.js.map +0 -1
  54. package/lib/module/react-native/components-factory/hooks/useWebObjectMountOnLaunch.js +0 -23
  55. package/lib/module/react-native/components-factory/hooks/useWebObjectMountOnLaunch.js.map +0 -1
  56. package/lib/module/react-native/components-factory/hooks/useWebObjectMountOnLaunch.mock.js +0 -5
  57. package/lib/module/react-native/components-factory/hooks/useWebObjectMountOnLaunch.mock.js.map +0 -1
  58. package/lib/module/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.js +0 -35
  59. package/lib/module/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.js.map +0 -1
  60. package/lib/module/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.mock.js +0 -5
  61. package/lib/module/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.mock.js.map +0 -1
  62. package/lib/typescript/src/react-native/components/Map/Map.test.d.ts +0 -2
  63. package/lib/typescript/src/react-native/components/Map/Map.test.d.ts.map +0 -1
  64. package/lib/typescript/src/react-native/components/MapProvider/MapProvider.test.d.ts +0 -2
  65. package/lib/typescript/src/react-native/components/MapProvider/MapProvider.test.d.ts.map +0 -1
  66. package/lib/typescript/src/react-native/components/Marker/Marker.test.d.ts +0 -2
  67. package/lib/typescript/src/react-native/components/Marker/Marker.test.d.ts.map +0 -1
  68. package/lib/typescript/src/react-native/components/Popup/Popup.test.d.ts +0 -2
  69. package/lib/typescript/src/react-native/components/Popup/Popup.test.d.ts.map +0 -1
  70. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.test.d.ts +0 -2
  71. package/lib/typescript/src/react-native/components-factory/createWebObjectAsComponent.test.d.ts.map +0 -1
  72. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountOnLaunch.d.ts +0 -14
  73. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountOnLaunch.d.ts.map +0 -1
  74. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountOnLaunch.mock.d.ts +0 -3
  75. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectMountOnLaunch.mock.d.ts.map +0 -1
  76. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.d.ts +0 -13
  77. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.d.ts.map +0 -1
  78. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.mock.d.ts +0 -3
  79. package/lib/typescript/src/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.mock.d.ts.map +0 -1
@@ -16,4 +16,4 @@ describe('Map', () => {
16
16
  });
17
17
  });
18
18
  });
19
- //# sourceMappingURL=Map.test.js.map
19
+ //# sourceMappingURL=Map.test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["render","Map","jsx","_jsx","describe","beforeEach","jest","clearAllMocks","test"],"sourceRoot":"../../../../../src","sources":["react-native/components/Map/Map.test.unit.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,GAAG,MAAM,UAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEvBC,QAAQ,CAAC,KAAK,EAAE,MAAM;EACpBC,UAAU,CAAC,MAAM;IACfC,IAAI,CAACC,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFH,QAAQ,CAAC,iCAAiC,EAAE,MAAM;IAChDC,UAAU,CAAC,MAAM;MACfL,MAAM,cAACG,IAAA,CAACF,GAAG,IAAE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEFG,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BI,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -6,12 +6,14 @@ import MapProvider from "./MapProvider.js";
6
6
  import { useWebMessageHandler } from "./MapProvider.hooks.js";
7
7
  import RNLogger from "../../logger/rn-logger.js";
8
8
  import { getWebObjectListenersMock, resolveWebObjectPendingMethodResponseMock, setIsWebWorldReadyMock } from "../../hooks/atoms/useMapAtoms.mock.js";
9
+ import { jest } from '@jest/globals';
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  const createEvent = data => ({
11
12
  nativeEvent: {
12
13
  data: typeof data === 'string' ? data : JSON.stringify(data)
13
14
  }
14
15
  });
16
+ jest.mock('./../../hooks/atoms/useMapAtoms', () => require('./../../hooks/atoms/useMapAtoms.mock'));
15
17
  describe('MapProvider', () => {
16
18
  beforeEach(() => {
17
19
  jest.clearAllMocks();
@@ -141,4 +143,4 @@ describe('useWebMessageHandler', () => {
141
143
  });
142
144
  });
143
145
  });
144
- //# sourceMappingURL=MapProvider.test.js.map
146
+ //# sourceMappingURL=MapProvider.test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["View","Text","render","renderHook","screen","MapProvider","useWebMessageHandler","RNLogger","getWebObjectListenersMock","resolveWebObjectPendingMethodResponseMock","setIsWebWorldReadyMock","jest","jsx","_jsx","createEvent","data","nativeEvent","JSON","stringify","mock","require","describe","beforeEach","clearAllMocks","children","testID","test","child","getByTestId","expect","toBeTruthy","webView","handler","result","current","toBe","type","not","toThrow","payload","level","args","info","toHaveBeenCalledWith","rnListener","eventPayload","fn","x","Math","random","mockReturnValue","click","objectId","eventName","event","requestId","ok"],"sourceRoot":"../../../../../src","sources":["react-native/components/MapProvider/MapProvider.test.unit.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,MAAM,EAAEC,UAAU,EAAEC,MAAM,QAAQ,+BAA+B;AAC1E,OAAOC,WAAW,MAAM,kBAAe;AACvC,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,OAAOC,QAAQ,MAAM,2BAAwB;AAC7C,SACEC,yBAAyB,EACzBC,yCAAyC,EACzCC,sBAAsB,QACjB,uCAAoC;AAC3C,SAASC,IAAI,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpC,MAAMC,WAAW,GAAIC,IAAa,KAC/B;EACCC,WAAW,EAAE;IACXD,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGE,IAAI,CAACC,SAAS,CAACH,IAAI;EAC7D;AACF,CAAC,CAAQ;AAEXJ,IAAI,CAACQ,IAAI,CAAC,iCAAiC,EAAE,MAC3CC,OAAO,CAAC,sCAAsC,CAChD,CAAC;AAEDC,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC5BC,UAAU,CAAC,MAAM;IACfX,IAAI,CAACY,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFF,QAAQ,CAAC,+CAA+C,EAAE,MAAM;IAC9DC,UAAU,CAAC,MAAM;MACfpB,MAAM,cACJW,IAAA,CAACR,WAAW;QAAAmB,QAAA,eACVX,IAAA,CAACb,IAAI;UAAAwB,QAAA,eACHX,IAAA,CAACZ,IAAI;YAACwB,MAAM,EAAC,OAAO;YAAAD,QAAA,EAAC;UAAK,CAAM;QAAC,CAC7B;MAAC,CACI,CACf,CAAC;IACH,CAAC,CAAC;IAEFH,QAAQ,CAAC,c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AC0C,eAAe,CAAC;UACxCC,KAAK,EAAE;YACLP;UACF;QACF,CAAC,CAAC;QACFZ,OAAO,CACLlB,WAAW,CAAC;UACVsB,IAAI,EAAE,wBAAwB;UAC9BG,OAAO,EAAE;YACPa,QAAQ,EAAE,UAAU;YACpBC,SAAS,EAAE,OAAO;YAClBC,KAAK,EAAET;UACT;QACF,CAAC,CACH,CAAC;MACH,CAAC,CAAC;MAEFnB,IAAI,CAAC,yDAAyD,EAAE,MAAM;QACpEG,MAAM,CAACe,UAAU,CAAC,CAACD,oBAAoB,CAACE,YAAY,CAAC;MACvD,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFxB,QAAQ,CAAC,2DAA2D,EAAE,MAAM;MAC1EC,UAAU,CAAC,MAAM;QACfU,OAAO,CACLlB,WAAW,CAAC;UACVsB,IAAI,EAAE,yBAAyB;UAC/BG,OAAO,EAAE;YACPgB,SAAS,EAAE,SAAS;YACpBtB,MAAM,EAAE;cAAEuB,EAAE,EAAE;YAAK;UACrB;QACF,CAAC,CACH,CAAC;MACH,CAAC,CAAC;MAEF9B,IAAI,CAAC,8CAA8C,EAAE,MAAM;QACzDG,MAAM,CAACpB,yCAAyC,CAAC,CAACkC,oBAAoB,CAAC;UACrEY,SAAS,EAAE,SAAS;UACpBtB,MAAM,EAAE;YAAEuB,EAAE,EAAE;UAAK;QACrB,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { render } from '@testing-library/react-native';
4
4
  import Marker from "./Marker.js";
5
+ import { jest } from '@jest/globals';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
7
  describe('Marker', () => {
7
8
  beforeEach(() => {
@@ -16,4 +17,4 @@ describe('Marker', () => {
16
17
  });
17
18
  });
18
19
  });
19
- //# sourceMappingURL=Marker.test.js.map
20
+ //# sourceMappingURL=Marker.test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["render","Marker","jest","jsx","_jsx","describe","beforeEach","clearAllMocks","test"],"sourceRoot":"../../../../../src","sources":["react-native/components/Marker/Marker.test.unit.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,MAAM,MAAM,aAAU;AAC7B,SAASC,IAAI,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpCC,QAAQ,CAAC,QAAQ,EAAE,MAAM;EACvBC,UAAU,CAAC,MAAM;IACfJ,IAAI,CAACK,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFF,QAAQ,CAAC,iCAAiC,EAAE,MAAM;IAChDC,UAAU,CAAC,MAAM;MACfN,MAAM,cAACI,IAAA,CAACH,MAAM,IAAE,CAAC,CAAC;IACpB,CAAC,CAAC;IAEFI,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BG,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -16,4 +16,4 @@ describe('Popup', () => {
16
16
  });
17
17
  });
18
18
  });
19
- //# sourceMappingURL=Popup.test.js.map
19
+ //# sourceMappingURL=Popup.test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["render","Popup","jsx","_jsx","describe","beforeEach","jest","clearAllMocks","test"],"sourceRoot":"../../../../../src","sources":["react-native/components/Popup/Popup.test.unit.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,KAAK,MAAM,YAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3BC,QAAQ,CAAC,OAAO,EAAE,MAAM;EACtBC,UAAU,CAAC,MAAM;IACfC,IAAI,CAACC,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFH,QAAQ,CAAC,iCAAiC,EAAE,MAAM;IAChDC,UAAU,CAAC,MAAM;MACfL,MAAM,cAACG,IAAA,CAACF,KAAK,IAAE,CAAC,CAAC;IACnB,CAAC,CAAC;IAEFG,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BI,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,25 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  import { forwardRef, useId } from 'react';
4
- import useWebObjectMountOnLaunch from "./hooks/useWebObjectMountOnLaunch.js";
5
4
  import useWebObjectMethodsProxy from "./hooks/useWebObjectMethodsProxy.js";
6
- import useWebObjectPropertiesUpdater from "./hooks/useWebObjectPropertiesUpdater.js";
7
- import useWebObjectMountUnmountCallbacks from "./hooks/useWebObjectMountUnmountCallbacks.js";
5
+ import useWebObjectMountUnmountWithProps from "./hooks/useWebObjectMountUnmountWithProps.js";
8
6
  const createWebObjectAsComponent = objectType => {
9
7
  return /*#__PURE__*/forwardRef((props, ref) => {
10
8
  // UID of the web object.
11
9
  const id = useId();
12
- // Callbacks to mount and unmount the web object.
13
- const {
14
- mount,
15
- unmount
16
- } = useWebObjectMountUnmountCallbacks(props, id, objectType);
17
- // Mount the web object on launch.
18
- useWebObjectMountOnLaunch(props, id, mount, unmount);
19
- // Forward a method call on the RN object to the web object.
10
+ // Forward a method call on the RN object ref to the web object.
20
11
  useWebObjectMethodsProxy(ref, id);
21
- // Update the web object properties when they changed in the component body.
22
- useWebObjectPropertiesUpdater(props, mount, unmount);
12
+ // Mount the web object on launch and update the web object properties when
13
+ // they changed in the component body.
14
+ useWebObjectMountUnmountWithProps(props, id, objectType);
23
15
  return null;
24
16
  });
25
17
  };
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","useId","useWebObjectMountOnLaunch","useWebObjectMethodsProxy","useWebObjectPropertiesUpdater","useWebObjectMountUnmountCallbacks","createWebObjectAsComponent","objectType","props","ref","id","mount","unmount"],"sourceRoot":"../../../../src","sources":["react-native/components-factory/createWebObjectAsComponent.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,KAAK,QAAQ,OAAO;AAOzC,OAAOC,yBAAyB,MAAM,sCAAmC;AACzE,OAAOC,wBAAwB,MAAM,qCAAkC;AACvE,OAAOC,6BAA6B,MAAM,0CAAuC;AACjF,OAAOC,iCAAiC,MAAM,8CAA2C;AAEzF,MAAMC,0BAA0B,GAI9BC,UAAyB,IACU;EACnC,oBAAOP,UAAU,CAAa,CAACQ,KAAK,EAAEC,GAAG,KAAK;IAC5C;IACA,MAAMC,EAAE,GAAGT,KAAK,CAAC,CAAC;IAClB;IACA,MAAM;MAAEU,KAAK;MAAEC;IAAQ,CAAC,GAAGP,iCAAiC,CAC1DG,KAAK,EACLE,EAAE,EACFH,UACF,CAAC;IACD;IACAL,yBAAyB,CAAQM,KAAK,EAAEE,EAAE,EAAEC,KAAK,EAAEC,OAAO,CAAC;IAC3D;IACAT,wBAAwB,CAAMM,GAAG,EAAEC,EAAE,CAAC;IACtC;IACAN,6BAA6B,CAAQI,KAAK,EAAEG,KAAK,EAAEC,OAAO,CAAC;IAE3D,OAAO,IAAI;EACb,CAAC,CAAC;AACJ,CAAC;AAED,eAAeN,0BAA0B","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","useId","useWebObjectMethodsProxy","useWebObjectMountUnmountWithProps","createWebObjectAsComponent","objectType","props","ref","id"],"sourceRoot":"../../../../src","sources":["react-native/components-factory/createWebObjectAsComponent.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,KAAK,QAAQ,OAAO;AAOzC,OAAOC,wBAAwB,MAAM,qCAAkC;AACvE,OAAOC,iCAAiC,MAAM,8CAA2C;AAEzF,MAAMC,0BAA0B,GAI9BC,UAAyB,IACU;EACnC,oBAAOL,UAAU,CAAa,CAACM,KAAK,EAAEC,GAAG,KAAK;IAC5C;IACA,MAAMC,EAAE,GAAGP,KAAK,CAAC,CAAC;IAClB;IACAC,wBAAwB,CAAMK,GAAG,EAAEC,EAAE,CAAC;IACtC;IACA;IACAL,iCAAiC,CAAQG,KAAK,EAAEE,EAAE,EAAEH,UAAU,CAAC;IAE/D,OAAO,IAAI;EACb,CAAC,CAAC;AACJ,CAAC;AAED,eAAeD,0BAA0B","ignoreList":[]}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ import { render, screen } from '@testing-library/react-native';
4
+ import createWebObjectAsComponent from "./createWebObjectAsComponent.js";
5
+ import { jest } from '@jest/globals';
6
+ import { mount, unmount } from "./hooks/useWebObjectMountUnmountCallbacks.mock.js";
7
+ import { setIsWebWorldReady } from "../hooks/atoms/useMapAtoms.mock.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ jest.mock('./../hooks/atoms/useMapAtoms', () => require('./../hooks/atoms/useMapAtoms.mock'));
10
+ jest.mock('./hooks/useWebObjectMountUnmountCallbacks', () => require('./hooks/useWebObjectMountUnmountCallbacks.mock'));
11
+ describe('createWebObjectAsComponent', () => {
12
+ beforeEach(() => {
13
+ jest.clearAllMocks();
14
+ });
15
+ describe('Given the web object is rendered and the web world is ready', () => {
16
+ let Component;
17
+ beforeEach(() => {
18
+ Component = createWebObjectAsComponent('map');
19
+ setIsWebWorldReady(true);
20
+ render(/*#__PURE__*/_jsx(Component, {}));
21
+ });
22
+ describe('When nothing', () => {
23
+ beforeEach(() => {});
24
+ test('Then everything have been mounted', () => {
25
+ expect(mount).toHaveBeenCalledTimes(1);
26
+ expect(mount).toHaveBeenCalledWith({
27
+ options: true,
28
+ listeners: true
29
+ });
30
+ });
31
+ });
32
+ describe('When rerendered with no change', () => {
33
+ beforeEach(() => {
34
+ screen.rerender(/*#__PURE__*/_jsx(Component, {}));
35
+ });
36
+ test('Then nothing is re-mounted', () => {
37
+ expect(unmount).toHaveBeenCalledTimes(1);
38
+ expect(mount).toHaveBeenCalledTimes(1);
39
+ });
40
+ });
41
+ describe('When rerendered with new listeners', () => {
42
+ beforeEach(() => {
43
+ screen.rerender(/*#__PURE__*/_jsx(Component, {
44
+ listeners: {
45
+ new: () => {}
46
+ }
47
+ }));
48
+ });
49
+ test('Then only the listeners have been re-mounted', () => {
50
+ expect(unmount).toHaveBeenCalledTimes(2);
51
+ expect(mount).toHaveBeenCalledTimes(2);
52
+ expect(unmount).toHaveBeenNthCalledWith(2, {
53
+ options: false,
54
+ listeners: true
55
+ });
56
+ expect(mount).toHaveBeenNthCalledWith(2, {
57
+ options: false,
58
+ listeners: true
59
+ });
60
+ });
61
+ });
62
+ describe('When rerendered with new options', () => {
63
+ beforeEach(() => {
64
+ screen.rerender(/*#__PURE__*/_jsx(Component, {
65
+ options: {
66
+ new: true
67
+ }
68
+ }));
69
+ });
70
+ test('Then everything have been re-mounted', () => {
71
+ expect(unmount).toHaveBeenCalledTimes(2);
72
+ expect(mount).toHaveBeenCalledTimes(2);
73
+ expect(unmount).toHaveBeenNthCalledWith(2, {
74
+ options: true,
75
+ listeners: true
76
+ });
77
+ expect(mount).toHaveBeenNthCalledWith(2, {
78
+ options: true,
79
+ listeners: true
80
+ });
81
+ });
82
+ });
83
+ });
84
+ });
85
+ //# sourceMappingURL=createWebObjectAsComponent.test.integration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["render","screen","createWebObjectAsComponent","jest","mount","unmount","setIsWebWorldReady","jsx","_jsx","mock","require","describe","beforeEach","clearAllMocks","Component","test","expect","toHaveBeenCalledTimes","toHaveBeenCalledWith","options","listeners","rerender","new","toHaveBeenNthCalledWith"],"sourceRoot":"../../../../src","sources":["react-native/components-factory/createWebObjectAsComponent.test.integration.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,MAAM,QAAQ,+BAA+B;AAC9D,OAAOC,0BAA0B,MAAM,iCAA8B;AACrE,SAASC,IAAI,QAAQ,eAAe;AAMpC,SAASC,KAAK,EAAEC,OAAO,QAAQ,mDAAgD;AAC/E,SAASC,kBAAkB,QAAQ,oCAAiC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpE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,CAAC,EAAE;UACvCJ,OAAO,EAAE,IAAI;UACbC,SAAS,EAAE;QACb,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ import { render } from '@testing-library/react-native';
4
+ import createWebObjectAsComponent from "./createWebObjectAsComponent.js";
5
+ import useWebObjectMethodsProxy from "./hooks/useWebObjectMethodsProxy.js";
6
+ import useWebObjectMountUnmountWithProps from "./hooks/useWebObjectMountUnmountWithProps.js";
7
+ import { jest } from '@jest/globals';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ jest.mock('./hooks/useWebObjectMethodsProxy', () => require('./hooks/useWebObjectMethodsProxy.mock'));
10
+ jest.mock('./hooks/useWebObjectMountUnmountWithProps', () => require('./hooks/useWebObjectMountUnmountWithProps.mock'));
11
+ describe('createWebObjectAsComponent', () => {
12
+ beforeEach(() => {
13
+ jest.clearAllMocks();
14
+ });
15
+ describe('Given the web object is rendered', () => {
16
+ beforeEach(() => {
17
+ const Component = createWebObjectAsComponent('map');
18
+ render(/*#__PURE__*/_jsx(Component, {}));
19
+ });
20
+ describe('When nothing', () => {
21
+ test('Then it has set the methods proxy', () => {
22
+ expect(useWebObjectMethodsProxy).toHaveBeenCalledTimes(1);
23
+ });
24
+ test('Then it has been mount on launch', () => {
25
+ expect(useWebObjectMountUnmountWithProps).toHaveBeenCalledTimes(1);
26
+ });
27
+ });
28
+ });
29
+ });
30
+ //# sourceMappingURL=createWebObjectAsComponent.test.unit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["render","createWebObjectAsComponent","useWebObjectMethodsProxy","useWebObjectMountUnmountWithProps","jest","jsx","_jsx","mock","require","describe","beforeEach","clearAllMocks","Component","test","expect","toHaveBeenCalledTimes"],"sourceRoot":"../../../../src","sources":["react-native/components-factory/createWebObjectAsComponent.test.unit.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,0BAA0B,MAAM,iCAA8B;AACrE,OAAOC,wBAAwB,MAAM,qCAAkC;AACvE,OAAOC,iCAAiC,MAAM,8CAA2C;AACzF,SAASC,IAAI,QAAQ,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEpCF,IAAI,CAACG,IAAI,CAAC,kCAAkC,EAAE,MAC5CC,OAAO,CAAC,uCAAuC,CACjD,CAAC;AAEDJ,IAAI,CAACG,IAAI,CAAC,2CAA2C,EAAE,MACrDC,OAAO,CAAC,gDAAgD,CAC1D,CAAC;AAEDC,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CC,UAAU,CAAC,MAAM;IACfN,IAAI,CAACO,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFF,QAAQ,CAAC,kCAAkC,EAAE,MAAM;IACjDC,UAAU,CAAC,MAAM;MACf,MAAME,SAAS,GAAGX,0BAA0B,CAAC,KAAK,CAAC;MACnDD,MAAM,cAACM,IAAA,CAACM,SAAS,IAAE,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFH,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BI,IAAI,CAAC,mCAAmC,EAAE,MAAM;QAC9CC,MAAM,CAACZ,wBAAwB,CAAC,CAACa,qBAAqB,CAAC,CAAC,CAAC;MAC3D,CAAC,CAAC;MAEFF,IAAI,CAAC,kCAAkC,EAAE,MAAM;QAC7CC,MAAM,CAACX,iCAAiC,CAAC,CAACY,qBAAqB,CAAC,CAAC,CAAC;MACpE,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -18,7 +18,6 @@ const useWebObjectMountUnmountCallbacks = (props, objectId, objectType) => {
18
18
  // States.
19
19
  // - Global.
20
20
  const {
21
- isWebWorldReady,
22
21
  dispatchMessage,
23
22
  setWebObjectListeners,
24
23
  deleteWebObjectListeners
@@ -27,9 +26,6 @@ const useWebObjectMountUnmountCallbacks = (props, objectId, objectType) => {
27
26
  options = true,
28
27
  listeners = true
29
28
  } = {}) => {
30
- if (!isWebWorldReady) {
31
- return;
32
- }
33
29
  // Mount the component as a web object within the web world.
34
30
  if (options && !areOptionsMounted.current) {
35
31
  dispatchMessage({
@@ -51,14 +47,11 @@ const useWebObjectMountUnmountCallbacks = (props, objectId, objectType) => {
51
47
  });
52
48
  areListenersMounted.current = true;
53
49
  }
54
- }, [objectId, objectType, props.options, props.listeners, isWebWorldReady, dispatchMessage, setWebObjectListeners]);
50
+ }, [objectId, objectType, props.options, props.listeners, dispatchMessage, setWebObjectListeners]);
55
51
  const unmount = useCallback(({
56
52
  options = true,
57
53
  listeners = true
58
54
  } = {}) => {
59
- if (!isWebWorldReady) {
60
- return;
61
- }
62
55
  // Mount the component as a web object within the web world.
63
56
  if (options && areOptionsMounted.current) {
64
57
  dispatchMessage({
@@ -76,7 +69,7 @@ const useWebObjectMountUnmountCallbacks = (props, objectId, objectType) => {
76
69
  });
77
70
  areListenersMounted.current = false;
78
71
  }
79
- }, [objectId, isWebWorldReady, dispatchMessage, deleteWebObjectListeners]);
72
+ }, [objectId, dispatchMessage, deleteWebObjectListeners]);
80
73
  return {
81
74
  mount,
82
75
  unmount
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useRef","useMapAtoms","useWebObjectMountUnmountCallbacks","props","objectId","objectType","areOptionsMounted","areListenersMounted","isWebWorldReady","dispatchMessage","setWebObjectListeners","deleteWebObjectListeners","mount","options","listeners","current","type","payload","unmount"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.ts"],"mappings":";;AACA,SAA+BA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAEjE,OAAOC,WAAW,MAAM,kCAA+B;AAGvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iCAAiC,GAAGA,CAGxCC,KAA6B,EAC7BC,QAAgB,EAChBC,UAAyB,KACtB;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eAAe,EAAE;MACpB;IACF;IACA;IACA,IAAIK,OAAO,IAAIP,iBAAiB,CAACS,OAAO,EAAE;MACxCN,eAAe,CAAC;QACdO,IAAI,EAAE,kBAAkB;QACxBC,OAAO,EAAE;UAAEb;QAAS;MACtB,CAAC,CAAC;MACFE,iBAAiB,CAACS,OAAO,GAAG,KAAK;IACnC;IACA;IACA,IAAID,SAAS,IAAIP,mBAAmB,CAACQ,OAAO,EAAE;MAC5CJ,wBAAwB,CAAC;QAAEP;MAAS,CAAC,CAAC;MACtCG,mBAAmB,CAACQ,OAAO,GAAG,KAAK;IACrC;EACF,CAAC,EACD,CAACX,QAAQ,EAAEI,eAAe,EAAEC,eAAe,EAAEE,wBAAwB,CACvE,CAAC;EAED,OAAO;IAAEC,KAAK;IAAEM;EAAQ,CAAC;AAC3B,CAAC;AAED,eAAehB,iCAAiC","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useRef","useMapAtoms","useWebObjectMountUnmountCallbacks","props","objectId","objectType","areOptionsMounted","areListenersMounted","dispatchMessage","setWebObjectListeners","deleteWebObjectListeners","mount","options","listeners","current","type","payload","unmount"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.ts"],"mappings":";;AACA,SAA+BA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAEjE,OAAOC,WAAW,MAAM,kCAA+B;AAGvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iCAAiC,GAAGA,CAGxCC,KAA6B,EAC7BC,QAAgB,EAChBC,UAAyB,KACtB;EACH;EACA,MAAMC,iBAAiB,GAAGN,MAAM,CAAU,KAAK,CAAC;EAChD,MAAMO,mBAAmB,GAAGP,MAAM,CAAU,KAAK,CAAC;EAClD;EACA;EACA,MAAM;IAAEQ,eAAe;IAAEC,qBAAqB;IAAEC;EAAyB,CAAC,GACxET,WAAW,CAAC,CAAC;EAEf,MAAMU,KAAK,GAAGZ,WAAW,CACvB,CAAC;I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GAAG,KAAK;IACrC;EACF,CAAC,EACD,CAACV,QAAQ,EAAEI,eAAe,EAAEE,wBAAwB,CACtD,CAAC;EAED,OAAO;IAAEC,KAAK;IAAEM;EAAQ,CAAC;AAC3B,CAAC;AAED,eAAef,iCAAiC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ export const mount = jest.fn();
4
+ export const unmount = jest.fn();
5
+ const useWebObjectMountUnmountCallbacksMock = () => ({
6
+ mount,
7
+ unmount
8
+ });
9
+ export default useWebObjectMountUnmountCallbacksMock;
10
+ //# sourceMappingURL=useWebObjectMountUnmountCallbacks.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mount","jest","fn","unmount","useWebObjectMountUnmountCallbacksMock"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.mock.ts"],"mappings":";;AAEA,OAAO,MAAMA,KAAK,GAAGC,IAAI,CAACC,EAAE,CAAC,CAAC;AAC9B,OAAO,MAAMC,OAAO,GAAGF,IAAI,CAACC,EAAE,CAAC,CAAC;AAEhC,MAAME,qCAAqC,GAAGA,CAAA,MAGxC;EACJJ,KAAK;EACLG;AACF,CAAC,CAAC;AAEF,eAAeC,qCAAqC","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ import { useEffect, useMemo, useRef } from 'react';
4
+ import { stableStringify } from "../../hooks/atoms/useMapAtoms.utils.js";
5
+ import useMapAtoms from "../../hooks/atoms/useMapAtoms.js";
6
+ import useWebObjectMountUnmountCallbacks from "./useWebObjectMountUnmountCallbacks.js";
7
+ /**
8
+ * Mount the component as a web object within the web world on component mount.
9
+ * Propagate any change in the component props to the web world by unmounting
10
+ * and mounting the web object with the new options.
11
+ * @param props - The RN object props.
12
+ * @param objectId - The ID of the web object that owns the method.
13
+ * @param objectType - The type of the associated web object.
14
+ */
15
+ export const useWebObjectMountUnmountWithProps = (props, objectId, objectType) => {
16
+ // Refs.
17
+ const optionsAsStringPrevious = useRef(undefined);
18
+ // States.
19
+ // - Local.
20
+ const hasBeenMountedAtLeastOnce = useRef(false);
21
+ // - Global.
22
+ const {
23
+ isWebWorldReady
24
+ } = useMapAtoms();
25
+ // Behaviors.
26
+ const {
27
+ mount,
28
+ unmount
29
+ } = useWebObjectMountUnmountCallbacks(props, objectId, objectType);
30
+ const optionsAsString = useMemo(() => stableStringify(props.options), [props]);
31
+
32
+ // Mount options only when they have changed (mounted in the web world), or
33
+ // that the web object has never been mounted.
34
+ // Listeners are always mounted: they are inexpensive (mounted in the RN
35
+ // world) and cannot be reliably compared when declared inline in the
36
+ // component, as they change on every render.
37
+ useEffect(() => {
38
+ if (!isWebWorldReady) {
39
+ return;
40
+ }
41
+ console.log('optionsAsStringPrevious', optionsAsStringPrevious.current, optionsAsString, hasBeenMountedAtLeastOnce.current);
42
+ const areOptionsEqual = optionsAsStringPrevious.current === optionsAsString;
43
+ const shouldMountOptions = !areOptionsEqual || !hasBeenMountedAtLeastOnce.current;
44
+ hasBeenMountedAtLeastOnce.current = true;
45
+ optionsAsStringPrevious.current = optionsAsString;
46
+ unmount({
47
+ options: shouldMountOptions,
48
+ listeners: true
49
+ });
50
+ mount({
51
+ options: shouldMountOptions,
52
+ listeners: true
53
+ });
54
+ }, [mount, unmount, optionsAsStringPrevious, optionsAsString, props.listeners, hasBeenMountedAtLeastOnce, isWebWorldReady]);
55
+ };
56
+ export default useWebObjectMountUnmountWithProps;
57
+ //# sourceMappingURL=useWebObjectMountUnmountWithProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useMemo","useRef","stableStringify","useMapAtoms","useWebObjectMountUnmountCallbacks","useWebObjectMountUnmountWithProps","props","objectId","objectType","optionsAsStringPrevious","undefined","hasBeenMountedAtLeastOnce","isWebWorldReady","mount","unmount","optionsAsString","options","console","log","current","areOptionsEqual","shouldMountOptions","listeners"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.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AC;MACJG,OAAO,EAAEK,kBAAkB;MAC3BC,SAAS,EAAE;IACb,CAAC,CAAC;EACJ,CAAC,EAAE,CACDT,KAAK,EACLC,OAAO,EACPL,uBAAuB,EACvBM,eAAe,EACfT,KAAK,CAACgB,SAAS,EACfX,yBAAyB,EACzBC,eAAe,CAChB,CAAC;AACJ,CAAC;AAED,eAAeP,iCAAiC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ const useWebObjectMountUnmountWithPropsMock = jest.fn();
4
+ export default useWebObjectMountUnmountWithPropsMock;
5
+ //# sourceMappingURL=useWebObjectMountUnmountWithProps.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useWebObjectMountUnmountWithPropsMock","jest","fn"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.mock.ts"],"mappings":";;AAAA,MAAMA,qCAAqC,GAAGC,IAAI,CAACC,EAAE,CAAC,CAAC;AAEvD,eAAeF,qCAAqC","ignoreList":[]}
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ let isWebWorldReady = false;
3
4
  export const setIsWebWorldReadyMock = jest.fn();
4
5
  export const getWebObjectListenersMock = jest.fn();
5
6
  export const resolveWebObjectPendingMethodResponseMock = jest.fn();
7
+ export const setIsWebWorldReady = value => {
8
+ isWebWorldReady = value;
9
+ };
6
10
  const useMapAtomsMock = () => ({
11
+ isWebWorldReady,
7
12
  setIsWebWorldReady: setIsWebWorldReadyMock,
8
13
  getWebObjectListeners: getWebObjectListenersMock,
9
14
  resolveWebObjectPendingMethodResponse: resolveWebObjectPendingMethodResponseMock
@@ -1 +1 @@
1
- {"version":3,"names":["setIsWebWorldReadyMock","jest","fn","getWebObjectListenersMock","resolveWebObjectPendingMethodResponseMock","useMapAtomsMock","setIsWebWorldReady","getWebObjectListeners","resolveWebObjectPendingMethodResponse"],"sourceRoot":"../../../../../src","sources":["react-native/hooks/atoms/useMapAtoms.mock.ts"],"mappings":";;AAAA,OAAO,MAAMA,sBAAsB,GAAGC,IAAI,CAACC,EAAE,CAAC,CAAC;AAC/C,OAAO,MAAMC,yBAAyB,GAAGF,IAAI,CAACC,EAAE,CAAC,CAAC;AAClD,OAAO,MAAME,yCAAyC,GAAGH,IAAI,CAACC,EAAE,CAAC,CAAC;AAElE,MAAMG,eAAe,GAAGA,CAAA,MAAO;EAC7BC,kBAAkB,EAAEN,sBAAsB;EAC1CO,qBAAqB,EAAEJ,yBAAyB;EAChDK,qCAAqC,EACnCJ;AACJ,CAAC,CAAC;AAEF,eAAeC,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["isWebWorldReady","setIsWebWorldReadyMock","jest","fn","getWebObjectListenersMock","resolveWebObjectPendingMethodResponseMock","setIsWebWorldReady","value","useMapAtomsMock","getWebObjectListeners","resolveWebObjectPendingMethodResponse"],"sourceRoot":"../../../../../src","sources":["react-native/hooks/atoms/useMapAtoms.mock.ts"],"mappings":";;AAAA,IAAIA,eAAe,GAAG,KAAK;AAE3B,OAAO,MAAMC,sBAAsB,GAAGC,IAAI,CAACC,EAAE,CAAC,CAAC;AAC/C,OAAO,MAAMC,yBAAyB,GAAGF,IAAI,CAACC,EAAE,CAAC,CAAC;AAClD,OAAO,MAAME,yCAAyC,GAAGH,IAAI,CAACC,EAAE,CAAC,CAAC;AAClE,OAAO,MAAMG,kBAAkB,GAAIC,KAAc,IAAK;EACpDP,eAAe,GAAGO,KAAK;AACzB,CAAC;AAED,MAAMC,eAAe,GAAGA,CAAA,MAAO;EAC7BR,eAAe;EACfM,kBAAkB,EAAEL,sBAAsB;EAC1CQ,qBAAqB,EAAEL,yBAAyB;EAChDM,qCAAqC,EACnCL;AACJ,CAAC,CAAC;AAEF,eAAeG,eAAe","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Map.test.unit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Map.test.unit.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/Map/Map.test.unit.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=MapProvider.test.unit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapProvider.test.unit.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/MapProvider/MapProvider.test.unit.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Marker.test.unit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Marker.test.unit.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/Marker/Marker.test.unit.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Popup.test.unit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popup.test.unit.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/Popup/Popup.test.unit.tsx"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"createWebObjectAsComponent.d.ts","sourceRoot":"","sources":["../../../../../src/react-native/components-factory/createWebObjectAsComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAMvE,QAAA,MAAM,0BAA0B,GAC9B,GAAG,SAAS,YAAY,CAAC,GAAG,CAAC,EAC7B,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAEtC,YAAY,aAAa,KACxB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAmB/B,CAAA;AAED,eAAe,0BAA0B,CAAA"}
1
+ {"version":3,"file":"createWebObjectAsComponent.d.ts","sourceRoot":"","sources":["../../../../../src/react-native/components-factory/createWebObjectAsComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAIvE,QAAA,MAAM,0BAA0B,GAC9B,GAAG,SAAS,YAAY,CAAC,GAAG,CAAC,EAC7B,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAEtC,YAAY,aAAa,KACxB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAY/B,CAAA;AAED,eAAe,0BAA0B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createWebObjectAsComponent.test.integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWebObjectAsComponent.test.integration.d.ts","sourceRoot":"","sources":["../../../../../src/react-native/components-factory/createWebObjectAsComponent.test.integration.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createWebObjectAsComponent.test.unit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWebObjectAsComponent.test.unit.d.ts","sourceRoot":"","sources":["../../../../../src/react-native/components-factory/createWebObjectAsComponent.test.unit.tsx"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"useWebObjectMountUnmountCallbacks.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,eAAe,EAAuB,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAE1E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AAE7F;;;;;;;;GAQG;AACH,QAAA,MAAM,iCAAiC,GACrC,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAEtC,OAAO,eAAe,CAAC,KAAK,CAAC,EAC7B,UAAU,MAAM,EAChB,YAAY,aAAa;sCAkBpB,4BAA4B;wCAyC5B,4BAA4B;CAsBlC,CAAA;AAED,eAAe,iCAAiC,CAAA"}
1
+ {"version":3,"file":"useWebObjectMountUnmountCallbacks.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,eAAe,EAAuB,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAE1E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AAE7F;;;;;;;;GAQG;AACH,QAAA,MAAM,iCAAiC,GACrC,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAEtC,OAAO,eAAe,CAAC,KAAK,CAAC,EAC7B,UAAU,MAAM,EAChB,YAAY,aAAa;sCAcpB,4BAA4B;wCAqC5B,4BAA4B;CAmBlC,CAAA;AAED,eAAe,iCAAiC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { MountUnmountCallbacksOptions } from './useWebObjectMountUnmountCallbacks.types';
2
+ export declare const mount: jest.Mock<any, any, any>;
3
+ export declare const unmount: jest.Mock<any, any, any>;
4
+ declare const useWebObjectMountUnmountCallbacksMock: () => {
5
+ mount: (options?: MountUnmountCallbacksOptions) => void;
6
+ unmount: (options?: MountUnmountCallbacksOptions) => void;
7
+ };
8
+ export default useWebObjectMountUnmountCallbacksMock;
9
+ //# sourceMappingURL=useWebObjectMountUnmountCallbacks.mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebObjectMountUnmountCallbacks.mock.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountUnmountCallbacks.mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AAE7F,eAAO,MAAM,KAAK,0BAAY,CAAA;AAC9B,eAAO,MAAM,OAAO,0BAAY,CAAA;AAEhC,QAAA,MAAM,qCAAqC,QAAO;IAChD,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,4BAA4B,KAAK,IAAI,CAAA;IACvD,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,4BAA4B,KAAK,IAAI,CAAA;CAIzD,CAAA;AAEF,eAAe,qCAAqC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { WebObjectProps } from '../createWebObjectAsComponent.types';
2
+ import { type PropsWithoutRef } from 'react';
3
+ import type { WebObjectType } from '../../../communication/messages.types';
4
+ /**
5
+ * Mount the component as a web object within the web world on component mount.
6
+ * Propagate any change in the component props to the web world by unmounting
7
+ * and mounting the web object with the new options.
8
+ * @param props - The RN object props.
9
+ * @param objectId - The ID of the web object that owns the method.
10
+ * @param objectType - The type of the associated web object.
11
+ */
12
+ export declare const useWebObjectMountUnmountWithProps: <Props extends WebObjectProps<any, any>>(props: PropsWithoutRef<Props>, objectId: string, objectType: WebObjectType) => void;
13
+ export default useWebObjectMountUnmountWithProps;
14
+ //# sourceMappingURL=useWebObjectMountUnmountWithProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebObjectMountUnmountWithProps.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,eAAe,EAA8B,MAAM,OAAO,CAAA;AAIxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,GAC5C,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAEtC,OAAO,eAAe,CAAC,KAAK,CAAC,EAC7B,UAAU,MAAM,EAChB,YAAY,aAAa,SAwD1B,CAAA;AAED,eAAe,iCAAiC,CAAA"}
@@ -0,0 +1,3 @@
1
+ declare const useWebObjectMountUnmountWithPropsMock: jest.Mock<any, any, any>;
2
+ export default useWebObjectMountUnmountWithPropsMock;
3
+ //# sourceMappingURL=useWebObjectMountUnmountWithProps.mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebObjectMountUnmountWithProps.mock.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountUnmountWithProps.mock.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,qCAAqC,0BAAY,CAAA;AAEvD,eAAe,qCAAqC,CAAA"}
@@ -1,7 +1,9 @@
1
1
  export declare const setIsWebWorldReadyMock: jest.Mock<any, any, any>;
2
2
  export declare const getWebObjectListenersMock: jest.Mock<any, any, any>;
3
3
  export declare const resolveWebObjectPendingMethodResponseMock: jest.Mock<any, any, any>;
4
+ export declare const setIsWebWorldReady: (value: boolean) => void;
4
5
  declare const useMapAtomsMock: () => {
6
+ isWebWorldReady: boolean;
5
7
  setIsWebWorldReady: jest.Mock<any, any, any>;
6
8
  getWebObjectListeners: jest.Mock<any, any, any>;
7
9
  resolveWebObjectPendingMethodResponse: jest.Mock<any, any, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"useMapAtoms.mock.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/hooks/atoms/useMapAtoms.mock.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,0BAAY,CAAA;AAC/C,eAAO,MAAM,yBAAyB,0BAAY,CAAA;AAClD,eAAO,MAAM,yCAAyC,0BAAY,CAAA;AAElE,QAAA,MAAM,eAAe;;;;CAKnB,CAAA;AAEF,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"useMapAtoms.mock.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/hooks/atoms/useMapAtoms.mock.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,0BAAY,CAAA;AAC/C,eAAO,MAAM,yBAAyB,0BAAY,CAAA;AAClD,eAAO,MAAM,yCAAyC,0BAAY,CAAA;AAClE,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,SAEhD,CAAA;AAED,QAAA,MAAM,eAAe;;;;;CAMnB,CAAA;AAEF,eAAe,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-maplibre-gl-js",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "MapLibre GL JS for React Native",
5
5
  "author": "Emilien Aufauvre <emilien.aufauvre@live.fr> (https://github.com/emilienaufauvre)",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"names":["render","Map","jsx","_jsx","describe","beforeEach","jest","clearAllMocks","test"],"sourceRoot":"../../../../../src","sources":["react-native/components/Map/Map.test.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,GAAG,MAAM,UAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEvBC,QAAQ,CAAC,KAAK,EAAE,MAAM;EACpBC,UAAU,CAAC,MAAM;IACfC,IAAI,CAACC,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFH,QAAQ,CAAC,iCAAiC,EAAE,MAAM;IAChDC,UAAU,CAAC,MAAM;MACfL,MAAM,cAACG,IAAA,CAACF,GAAG,IAAE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEFG,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BI,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["View","Text","render","renderHook","screen","MapProvider","useWebMessageHandler","RNLogger","getWebObjectListenersMock","resolveWebObjectPendingMethodResponseMock","setIsWebWorldReadyMock","jsx","_jsx","createEvent","data","nativeEvent","JSON","stringify","describe","beforeEach","jest","clearAllMocks","children","testID","test","child","getByTestId","expect","toBeTruthy","webView","handler","result","current","toBe","type","not","toThrow","payload","level","args","info","toHaveBeenCalledWith","rnListener","eventPayload","fn","x","Math","random","mockReturnValue","click","objectId","eventName","event","requestId","ok"],"sourceRoot":"../../../../../src","sources":["react-native/components/MapProvider/MapProvider.test.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,MAAM,EAAEC,UAAU,EAAEC,MAAM,QAAQ,+BAA+B;AAC1E,OAAOC,WAAW,MAAM,kBAAe;AACvC,SAASC,oBAAoB,QAAQ,wBAAqB;AAC1D,OAAOC,QAAQ,MAAM,2BAAwB;AAC7C,SACEC,yBAAyB,EACzBC,yCAAyC,EACzCC,sBAAsB,QACjB,uCAAoC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAMC,WAAW,GAAIC,IAAa,KAC/B;EACCC,WAAW,EAAE;IACXD,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGE,IAAI,CAACC,SAAS,CAACH,IAAI;EAC7D;AACF,CAAC,CAAQ;AAEXI,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC5BC,UAAU,CAAC,MAAM;IACfC,IAAI,CAACC,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFH,QAAQ,CAAC,+CAA+C,EAAE,MAAM;IAC9DC,UAAU,CAAC,MAAM;MACfjB,MAAM,cACJU,IAAA,CAACP,WAAW;QAAAiB,QAAA,eACVV,IAAA,CAACZ,IAAI;UAAAsB,QAAA,eACHV,IAAA,CAACX,IAAI;YAACsB,MAAM,EAAC,OAAO;YAAAD,QAAA,EAAC;UAAK,CAAM;QAAC,CAC7B;MAAC,CACI,CACf,CAAC;IACH,CAAC,CAAC;IAEFJ,QAAQ,CA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AyB,CAACwC,eAAe,CAAC;UACxCC,KAAK,EAAE;YACLP;UACF;QACF,CAAC,CAAC;QACFZ,OAAO,CACLjB,WAAW,CAAC;UACVqB,IAAI,EAAE,wBAAwB;UAC9BG,OAAO,EAAE;YACPa,QAAQ,EAAE,UAAU;YACpBC,SAAS,EAAE,OAAO;YAClBC,KAAK,EAAET;UACT;QACF,CAAC,CACH,CAAC;MACH,CAAC,CAAC;MAEFnB,IAAI,CAAC,yDAAyD,EAAE,MAAM;QACpEG,MAAM,CAACe,UAAU,CAAC,CAACD,oBAAoB,CAACE,YAAY,CAAC;MACvD,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFzB,QAAQ,CAAC,2DAA2D,EAAE,MAAM;MAC1EC,UAAU,CAAC,MAAM;QACfW,OAAO,CACLjB,WAAW,CAAC;UACVqB,IAAI,EAAE,yBAAyB;UAC/BG,OAAO,EAAE;YACPgB,SAAS,EAAE,SAAS;YACpBtB,MAAM,EAAE;cAAEuB,EAAE,EAAE;YAAK;UACrB;QACF,CAAC,CACH,CAAC;MACH,CAAC,CAAC;MAEF9B,IAAI,CAAC,8CAA8C,EAAE,MAAM;QACzDG,MAAM,CAAClB,yCAAyC,CAAC,CAACgC,oBAAoB,CAAC;UACrEY,SAAS,EAAE,SAAS;UACpBtB,MAAM,EAAE;YAAEuB,EAAE,EAAE;UAAK;QACrB,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["render","Marker","jsx","_jsx","describe","beforeEach","jest","clearAllMocks","test"],"sourceRoot":"../../../../../src","sources":["react-native/components/Marker/Marker.test.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,MAAM,MAAM,aAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE7BC,QAAQ,CAAC,QAAQ,EAAE,MAAM;EACvBC,UAAU,CAAC,MAAM;IACfC,IAAI,CAACC,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFH,QAAQ,CAAC,iCAAiC,EAAE,MAAM;IAChDC,UAAU,CAAC,MAAM;MACfL,MAAM,cAACG,IAAA,CAACF,MAAM,IAAE,CAAC,CAAC;IACpB,CAAC,CAAC;IAEFG,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BI,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["render","Popup","jsx","_jsx","describe","beforeEach","jest","clearAllMocks","test"],"sourceRoot":"../../../../../src","sources":["react-native/components/Popup/Popup.test.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,KAAK,MAAM,YAAS;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3BC,QAAQ,CAAC,OAAO,EAAE,MAAM;EACtBC,UAAU,CAAC,MAAM;IACfC,IAAI,CAACC,aAAa,CAAC,CAAC;EACtB,CAAC,CAAC;EAEFH,QAAQ,CAAC,iCAAiC,EAAE,MAAM;IAChDC,UAAU,CAAC,MAAM;MACfL,MAAM,cAACG,IAAA,CAACF,KAAK,IAAE,CAAC,CAAC;IACnB,CAAC,CAAC;IAEFG,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BI,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- import { render } from '@testing-library/react-native';
4
- import createWebObjectAsComponent from "./createWebObjectAsComponent.js";
5
- import useWebObjectMountOnLaunch from "./hooks/useWebObjectMountOnLaunch.js";
6
- import useWebObjectMethodsProxy from "./hooks/useWebObjectMethodsProxy.js";
7
- import useWebObjectPropertiesUpdater from "./hooks/useWebObjectPropertiesUpdater.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- describe('createWebObjectAsComponent', () => {
10
- describe('Given a web object', () => {
11
- beforeEach(() => {
12
- const Component = createWebObjectAsComponent('map');
13
- render(/*#__PURE__*/_jsx(Component, {}));
14
- });
15
- describe('When nothing', () => {
16
- test('Then it has been mount on launch', () => {
17
- expect(useWebObjectMountOnLaunch).toHaveBeenCalled();
18
- });
19
- test('Then it has set the methods proxy', () => {
20
- expect(useWebObjectMethodsProxy).toHaveBeenCalled();
21
- });
22
- test('Then it has set the properties updater', () => {
23
- expect(useWebObjectPropertiesUpdater).toHaveBeenCalled();
24
- });
25
- });
26
- });
27
- });
28
- //# sourceMappingURL=createWebObjectAsComponent.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["render","createWebObjectAsComponent","useWebObjectMountOnLaunch","useWebObjectMethodsProxy","useWebObjectPropertiesUpdater","jsx","_jsx","describe","beforeEach","Component","test","expect","toHaveBeenCalled"],"sourceRoot":"../../../../src","sources":["react-native/components-factory/createWebObjectAsComponent.test.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,+BAA+B;AACtD,OAAOC,0BAA0B,MAAM,iCAA8B;AACrE,OAAOC,yBAAyB,MAAM,sCAAmC;AACzE,OAAOC,wBAAwB,MAAM,qCAAkC;AACvE,OAAOC,6BAA6B,MAAM,0CAAuC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEjFC,QAAQ,CAAC,4BAA4B,EAAE,MAAM;EAC3CA,QAAQ,CAAC,oBAAoB,EAAE,MAAM;IACnCC,UAAU,CAAC,MAAM;MACf,MAAMC,SAAS,GAAGR,0BAA0B,CAAC,KAAK,CAAC;MACnDD,MAAM,cAACM,IAAA,CAACG,SAAS,IAAE,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFF,QAAQ,CAAC,cAAc,EAAE,MAAM;MAC7BG,IAAI,CAAC,kCAAkC,EAAE,MAAM;QAC7CC,MAAM,CAACT,yBAAyB,CAAC,CAACU,gBAAgB,CAAC,CAAC;MACtD,CAAC,CAAC;MAEFF,IAAI,CAAC,mCAAmC,EAAE,MAAM;QAC9CC,MAAM,CAACR,wBAAwB,CAAC,CAACS,gBAAgB,CAAC,CAAC;MACrD,CAAC,CAAC;MAEFF,IAAI,CAAC,wCAAwC,EAAE,MAAM;QACnDC,MAAM,CAACP,6BAA6B,CAAC,CAACQ,gBAAgB,CAAC,CAAC;MAC1D,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect } from 'react';
4
- /**
5
- * Mount and unmount the web object once the React Native one is mounted /
6
- * unmounted.
7
- * @param props - The RN object props.
8
- * @param objectId - The ID of the web object that owns the method.
9
- * @param mount - Callback.
10
- * @param unmount - Callback.
11
- */
12
- const useWebObjectMountOnLaunch = (props, objectId, mount, unmount) => {
13
- // On mount/unmount, do the same for the web object.
14
- useEffect(() => {
15
- mount();
16
- // TODO verify if we unmount here? it sure that it must not be in this
17
- // use effect, otherwise on start if mount then unmount then mount, but
18
- // we may have to unmount in another effect
19
- //return unmount()
20
- }, [objectId, props, mount, unmount]);
21
- };
22
- export default useWebObjectMountOnLaunch;
23
- //# sourceMappingURL=useWebObjectMountOnLaunch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useWebObjectMountOnLaunch","props","objectId","mount","unmount"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountOnLaunch.ts"],"mappings":";;AAAA,SAA+BA,SAAS,QAAQ,OAAO;AAIvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,yBAAyB,GAAGA,CAChCC,KAA6B,EAC7BC,QAAgB,EAChBC,KAAuD,EACvDC,OAAyD,KACtD;EACH;EACAL,SAAS,CAAC,MAAM;IACdI,KAAK,CAAC,CAAC;IACP;IACA;IACA;IACA;EACF,CAAC,EAAE,CAACD,QAAQ,EAAED,KAAK,EAAEE,KAAK,EAAEC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED,eAAeJ,yBAAyB","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- const useWebObjectMountOnLaunchMock = jest.fn();
4
- export default useWebObjectMountOnLaunchMock;
5
- //# sourceMappingURL=useWebObjectMountOnLaunch.mock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useWebObjectMountOnLaunchMock","jest","fn"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectMountOnLaunch.mock.ts"],"mappings":";;AAAA,MAAMA,6BAA6B,GAAGC,IAAI,CAACC,EAAE,CAAC,CAAC;AAE/C,eAAeF,6BAA6B","ignoreList":[]}
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useMemo, useRef } from 'react';
4
- import { stableStringify } from "../../hooks/atoms/useMapAtoms.utils.js";
5
- /**
6
- * Propagate any change in the component props to the web world, by unmounting
7
- * and mounting the web object with the new options.
8
- * @param props - The RN object props.
9
- * @param mount - Callback.
10
- * @param unmount - Callback.
11
- */
12
- export const useWebObjectPropertiesUpdater = (props, mount, unmount) => {
13
- // Refs.
14
- const optionsAsStringPrevious = useRef('');
15
- const optionsAsString = useMemo(() => stableStringify(props.options), [props]);
16
-
17
- // Mount options only when they have changed (mounted in the web world).
18
- // Listeners are always mounted: they are inexpensive (mounted in the RN
19
- // world) and cannot be reliably compared when declared inline in the
20
- // component, as they change on every render.
21
- useEffect(() => {
22
- const areOptionsEqual = optionsAsStringPrevious.current === optionsAsString;
23
- unmount({
24
- options: !areOptionsEqual,
25
- listeners: true
26
- });
27
- mount({
28
- options: !areOptionsEqual,
29
- listeners: true
30
- });
31
- optionsAsStringPrevious.current = optionsAsString;
32
- }, [mount, unmount, optionsAsStringPrevious, optionsAsString, props.listeners]);
33
- };
34
- export default useWebObjectPropertiesUpdater;
35
- //# sourceMappingURL=useWebObjectPropertiesUpdater.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useMemo","useRef","stableStringify","useWebObjectPropertiesUpdater","props","mount","unmount","optionsAsStringPrevious","optionsAsString","options","areOptionsEqual","current","listeners"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectPropertiesUpdater.ts"],"mappings":";;AACA,SAA+BA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACxE,SAASC,eAAe,QAAQ,wCAAqC;AAGrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,GAAGA,CAG3CC,KAA6B,EAC7BC,KAAuD,EACvDC,OAAyD,KACtD;EACH;EACA,MAAMC,uBAAuB,GAAGN,MAAM,CAAS,EAAE,CAAC;EAElD,MAAMO,eAAe,GAAGR,OAAO,CAAC,MAAME,eAAe,CAACE,KAAK,CAACK,OAAO,CAAC,EAAE,CAACL,KAAK,CAAC,CAAC;;EAE9E;EACA;EACA;EACA;EACAL,SAAS,CAAC,MAAM;IACd,MAAMW,eAAe,GAAGH,uBAAuB,CAACI,OAAO,KAAKH,eAAe;IAC3EF,OAAO,CAAC;MAAEG,OAAO,EAAE,CAACC,eAAe;MAAEE,SAAS,EAAE;IAAK,CAAC,CAAC;IACvDP,KAAK,CAAC;MAAEI,OAAO,EAAE,CAACC,eAAe;MAAEE,SAAS,EAAE;IAAK,CAAC,CAAC;IACrDL,uBAAuB,CAACI,OAAO,GAAGH,eAAe;EACnD,CAAC,EAAE,CACDH,KAAK,EACLC,OAAO,EACPC,uBAAuB,EACvBC,eAAe,EACfJ,KAAK,CAACQ,SAAS,CAChB,CAAC;AACJ,CAAC;AAED,eAAeT,6BAA6B","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- const useWebObjectPropertiesUpdaterMock = jest.fn();
4
- export default useWebObjectPropertiesUpdaterMock;
5
- //# sourceMappingURL=useWebObjectPropertiesUpdater.mock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useWebObjectPropertiesUpdaterMock","jest","fn"],"sourceRoot":"../../../../../src","sources":["react-native/components-factory/hooks/useWebObjectPropertiesUpdater.mock.ts"],"mappings":";;AAAA,MAAMA,iCAAiC,GAAGC,IAAI,CAACC,EAAE,CAAC,CAAC;AAEnD,eAAeF,iCAAiC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Map.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Map.test.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/Map/Map.test.tsx"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MapProvider.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MapProvider.test.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/MapProvider/MapProvider.test.tsx"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Marker.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Marker.test.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/Marker/Marker.test.tsx"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Popup.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Popup.test.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components/Popup/Popup.test.tsx"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createWebObjectAsComponent.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createWebObjectAsComponent.test.d.ts","sourceRoot":"","sources":["../../../../../src/react-native/components-factory/createWebObjectAsComponent.test.tsx"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import { type PropsWithoutRef } from 'react';
2
- import type { WebObjectProps } from '../createWebObjectAsComponent.types';
3
- import type { MountUnmountCallbacksOptions } from './useWebObjectMountUnmountCallbacks.types';
4
- /**
5
- * Mount and unmount the web object once the React Native one is mounted /
6
- * unmounted.
7
- * @param props - The RN object props.
8
- * @param objectId - The ID of the web object that owns the method.
9
- * @param mount - Callback.
10
- * @param unmount - Callback.
11
- */
12
- declare const useWebObjectMountOnLaunch: <Props extends WebObjectProps<any, any>>(props: PropsWithoutRef<Props>, objectId: string, mount: (options?: MountUnmountCallbacksOptions) => void, unmount: (options?: MountUnmountCallbacksOptions) => void) => void;
13
- export default useWebObjectMountOnLaunch;
14
- //# sourceMappingURL=useWebObjectMountOnLaunch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebObjectMountOnLaunch.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountOnLaunch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAa,MAAM,OAAO,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AAE7F;;;;;;;GAOG;AACH,QAAA,MAAM,yBAAyB,GAAI,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EACvE,OAAO,eAAe,CAAC,KAAK,CAAC,EAC7B,UAAU,MAAM,EAChB,OAAO,CAAC,OAAO,CAAC,EAAE,4BAA4B,KAAK,IAAI,EACvD,SAAS,CAAC,OAAO,CAAC,EAAE,4BAA4B,KAAK,IAAI,SAU1D,CAAA;AAED,eAAe,yBAAyB,CAAA"}
@@ -1,3 +0,0 @@
1
- declare const useWebObjectMountOnLaunchMock: jest.Mock<any, any, any>;
2
- export default useWebObjectMountOnLaunchMock;
3
- //# sourceMappingURL=useWebObjectMountOnLaunch.mock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebObjectMountOnLaunch.mock.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectMountOnLaunch.mock.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,6BAA6B,0BAAY,CAAA;AAE/C,eAAe,6BAA6B,CAAA"}
@@ -1,13 +0,0 @@
1
- import type { WebObjectProps } from '../createWebObjectAsComponent.types';
2
- import { type PropsWithoutRef } from 'react';
3
- import type { MountUnmountCallbacksOptions } from './useWebObjectMountUnmountCallbacks.types';
4
- /**
5
- * Propagate any change in the component props to the web world, by unmounting
6
- * and mounting the web object with the new options.
7
- * @param props - The RN object props.
8
- * @param mount - Callback.
9
- * @param unmount - Callback.
10
- */
11
- export declare const useWebObjectPropertiesUpdater: <Props extends WebObjectProps<any, any>>(props: PropsWithoutRef<Props>, mount: (options?: MountUnmountCallbacksOptions) => void, unmount: (options?: MountUnmountCallbacksOptions) => void) => void;
12
- export default useWebObjectPropertiesUpdater;
13
- //# sourceMappingURL=useWebObjectPropertiesUpdater.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebObjectPropertiesUpdater.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,eAAe,EAA8B,MAAM,OAAO,CAAA;AAExE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GACxC,KAAK,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,EAEtC,OAAO,eAAe,CAAC,KAAK,CAAC,EAC7B,OAAO,CAAC,OAAO,CAAC,EAAE,4BAA4B,KAAK,IAAI,EACvD,SAAS,CAAC,OAAO,CAAC,EAAE,4BAA4B,KAAK,IAAI,SAuB1D,CAAA;AAED,eAAe,6BAA6B,CAAA"}
@@ -1,3 +0,0 @@
1
- declare const useWebObjectPropertiesUpdaterMock: jest.Mock<any, any, any>;
2
- export default useWebObjectPropertiesUpdaterMock;
3
- //# sourceMappingURL=useWebObjectPropertiesUpdater.mock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWebObjectPropertiesUpdater.mock.d.ts","sourceRoot":"","sources":["../../../../../../src/react-native/components-factory/hooks/useWebObjectPropertiesUpdater.mock.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iCAAiC,0BAAY,CAAA;AAEnD,eAAe,iCAAiC,CAAA"}