@leonsilicon/react-native-wishlist 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/LICENSE +20 -0
  2. package/MGWishList.podspec +40 -0
  3. package/README.md +281 -0
  4. package/android/CMakeLists.txt +86 -0
  5. package/android/build.gradle +72 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/spotless.gradle +24 -0
  8. package/android/src/main/AndroidManifest.xml +4 -0
  9. package/android/src/main/java/com/wishlist/ContentContainer.kt +22 -0
  10. package/android/src/main/java/com/wishlist/Orchestrator.kt +38 -0
  11. package/android/src/main/java/com/wishlist/TemplateContainer.kt +30 -0
  12. package/android/src/main/java/com/wishlist/TemplateContainerViewManager.kt +65 -0
  13. package/android/src/main/java/com/wishlist/TemplateInterceptor.kt +29 -0
  14. package/android/src/main/java/com/wishlist/TemplateInterceptorViewManager.kt +23 -0
  15. package/android/src/main/java/com/wishlist/UIScheduler.kt +15 -0
  16. package/android/src/main/java/com/wishlist/Wishlist.kt +135 -0
  17. package/android/src/main/java/com/wishlist/WishlistManagerModule.kt +51 -0
  18. package/android/src/main/java/com/wishlist/WishlistPackage.kt +47 -0
  19. package/android/src/main/java/com/wishlist/WishlistSoLoader.kt +17 -0
  20. package/android/src/main/java/com/wishlist/WishlistViewManager.kt +69 -0
  21. package/android/src/main/jni/ErrorHandlerAndroid.cpp +16 -0
  22. package/android/src/main/jni/ErrorHandlerAndroid.h +13 -0
  23. package/android/src/main/jni/JNIStateRegistry.cpp +22 -0
  24. package/android/src/main/jni/JNIStateRegistry.h +23 -0
  25. package/android/src/main/jni/OnLoad.cpp +12 -0
  26. package/android/src/main/jni/Orchestrator.cpp +167 -0
  27. package/android/src/main/jni/Orchestrator.hpp +78 -0
  28. package/android/src/main/jni/UISchedulerAndroid.cpp +20 -0
  29. package/android/src/main/jni/UISchedulerAndroid.h +18 -0
  30. package/android/src/main/jni/WishlistManagerModule.cpp +91 -0
  31. package/android/src/main/jni/WishlistManagerModule.hpp +43 -0
  32. package/android/src/main/jni/wishlist.h +19 -0
  33. package/cpp/ContentContainer/MGContentContainerComponentDescriptor.h +40 -0
  34. package/cpp/ContentContainer/MGContentContainerShadowNode.cpp +21 -0
  35. package/cpp/ContentContainer/MGContentContainerShadowNode.h +30 -0
  36. package/cpp/ContentContainer/MGContentContainerState.cpp +31 -0
  37. package/cpp/ContentContainer/MGContentContainerState.h +39 -0
  38. package/cpp/DataBinding/MGBindingProvider.hpp +21 -0
  39. package/cpp/DataBinding/MGDataBinding.hpp +23 -0
  40. package/cpp/DataBinding/MGDataBindingImpl.cpp +112 -0
  41. package/cpp/DataBinding/MGDataBindingImpl.hpp +35 -0
  42. package/cpp/DependencyInjection/MGDI.hpp +33 -0
  43. package/cpp/DependencyInjection/MGDIImpl.cpp +65 -0
  44. package/cpp/DependencyInjection/MGDIImpl.hpp +45 -0
  45. package/cpp/DependencyInjection/MGUIManagerHolder.cpp +21 -0
  46. package/cpp/DependencyInjection/MGUIManagerHolder.h +24 -0
  47. package/cpp/ItemProvider/ComponentsPool.cpp +91 -0
  48. package/cpp/ItemProvider/ComponentsPool.h +49 -0
  49. package/cpp/ItemProvider/ItemProvider.cpp +60 -0
  50. package/cpp/ItemProvider/ItemProvider.h +67 -0
  51. package/cpp/ItemProvider/ShadowNodeBinding.cpp +356 -0
  52. package/cpp/ItemProvider/ShadowNodeBinding.h +59 -0
  53. package/cpp/ItemProvider/ShadowNodeCopyMachine.cpp +95 -0
  54. package/cpp/ItemProvider/ShadowNodeCopyMachine.h +25 -0
  55. package/cpp/MGErrorHandler.h +12 -0
  56. package/cpp/MGViewportCarer/MGVSyncRequester.hpp +18 -0
  57. package/cpp/MGViewportCarer/MGViewportCarer.hpp +42 -0
  58. package/cpp/MGViewportCarer/MGViewportCarerImpl.cpp +453 -0
  59. package/cpp/MGViewportCarer/MGViewportCarerImpl.h +80 -0
  60. package/cpp/MGViewportCarer/MGViewportCarerListener.hpp +27 -0
  61. package/cpp/TemplateContainer/MGTemplateContainerComponentDescriptor.h +15 -0
  62. package/cpp/TemplateContainer/MGTemplateContainerShadowNode.cpp +43 -0
  63. package/cpp/TemplateContainer/MGTemplateContainerShadowNode.h +42 -0
  64. package/cpp/TemplateContainer/MGTemplateContainerState.cpp +37 -0
  65. package/cpp/TemplateContainer/MGTemplateContainerState.h +39 -0
  66. package/cpp/UIScheduler/MGUIScheduler.cpp +8 -0
  67. package/cpp/UIScheduler/MGUIScheduler.hpp +18 -0
  68. package/cpp/Wishlist/MGWishlistComponentDescriptor.h +14 -0
  69. package/cpp/Wishlist/MGWishlistShadowNode.cpp +49 -0
  70. package/cpp/Wishlist/MGWishlistShadowNode.h +37 -0
  71. package/cpp/Wishlist/MGWishlistState.cpp +57 -0
  72. package/cpp/Wishlist/MGWishlistState.h +42 -0
  73. package/cpp/WishlistDefine.h +3 -0
  74. package/cpp/WishlistJsRuntime.cpp +139 -0
  75. package/cpp/WishlistJsRuntime.h +59 -0
  76. package/ios/MGContentContainerComponent.h +9 -0
  77. package/ios/MGContentContainerComponent.mm +34 -0
  78. package/ios/MGErrorHandlerIOS.h +13 -0
  79. package/ios/MGErrorHandlerIOS.mm +12 -0
  80. package/ios/MGObjCJSIUtils.h +63 -0
  81. package/ios/MGTemplateContainerComponent.h +12 -0
  82. package/ios/MGTemplateContainerComponent.mm +105 -0
  83. package/ios/MGTemplateInterceptorComponent.h +9 -0
  84. package/ios/MGTemplateInterceptorComponent.mm +72 -0
  85. package/ios/MGWishListComponent.h +17 -0
  86. package/ios/MGWishListComponent.mm +187 -0
  87. package/ios/MGWishlistManager.h +21 -0
  88. package/ios/MGWishlistManager.mm +319 -0
  89. package/ios/MGWishlistQueue.h +11 -0
  90. package/ios/MGWishlistQueue.m +34 -0
  91. package/ios/Orchestrator/MGOrchestrator.h +35 -0
  92. package/ios/Orchestrator/MGOrchestrator.mm +139 -0
  93. package/ios/Orchestrator/MGOrchestratorCppAdapter.cpp +25 -0
  94. package/ios/Orchestrator/MGOrchestratorCppAdapter.hpp +32 -0
  95. package/ios/UIScheduleriOS/MGUIScheduleriOS.hpp +19 -0
  96. package/ios/UIScheduleriOS/MGUIScheduleriOS.mm +21 -0
  97. package/lib/commonjs/Colors.js +399 -0
  98. package/lib/commonjs/Colors.js.map +1 -0
  99. package/lib/commonjs/ComponentPool.js +28 -0
  100. package/lib/commonjs/ComponentPool.js.map +1 -0
  101. package/lib/commonjs/Components/ForEach.js +21 -0
  102. package/lib/commonjs/Components/ForEach.js.map +1 -0
  103. package/lib/commonjs/Components/ForEachBase.js +19 -0
  104. package/lib/commonjs/Components/ForEachBase.js.map +1 -0
  105. package/lib/commonjs/Components/IF.js +34 -0
  106. package/lib/commonjs/Components/IF.js.map +1 -0
  107. package/lib/commonjs/Components/Pressable.js +73 -0
  108. package/lib/commonjs/Components/Pressable.js.map +1 -0
  109. package/lib/commonjs/Components/Switch.js +52 -0
  110. package/lib/commonjs/Components/Switch.js.map +1 -0
  111. package/lib/commonjs/Components/WishlistImage.js +29 -0
  112. package/lib/commonjs/Components/WishlistImage.js.map +1 -0
  113. package/lib/commonjs/Components/WishlistText.js +24 -0
  114. package/lib/commonjs/Components/WishlistText.js.map +1 -0
  115. package/lib/commonjs/Components/WishlistView.js +10 -0
  116. package/lib/commonjs/Components/WishlistView.js.map +1 -0
  117. package/lib/commonjs/EventHandler.js +72 -0
  118. package/lib/commonjs/EventHandler.js.map +1 -0
  119. package/lib/commonjs/InflatorRepository.js +155 -0
  120. package/lib/commonjs/InflatorRepository.js.map +1 -0
  121. package/lib/commonjs/OrchestratorBinding.js +12 -0
  122. package/lib/commonjs/OrchestratorBinding.js.map +1 -0
  123. package/lib/commonjs/Specs/NativeContentContainer.js +12 -0
  124. package/lib/commonjs/Specs/NativeContentContainer.js.map +1 -0
  125. package/lib/commonjs/Specs/NativeTemplateContainer.js +12 -0
  126. package/lib/commonjs/Specs/NativeTemplateContainer.js.map +1 -0
  127. package/lib/commonjs/Specs/NativeTemplateInterceptor.js +10 -0
  128. package/lib/commonjs/Specs/NativeTemplateInterceptor.js.map +1 -0
  129. package/lib/commonjs/Specs/NativeWishlist.js +16 -0
  130. package/lib/commonjs/Specs/NativeWishlist.js.map +1 -0
  131. package/lib/commonjs/Specs/NativeWishlistManager.js +9 -0
  132. package/lib/commonjs/Specs/NativeWishlistManager.js.map +1 -0
  133. package/lib/commonjs/TemplateContext.js +17 -0
  134. package/lib/commonjs/TemplateContext.js.map +1 -0
  135. package/lib/commonjs/TemplateItem.js +2 -0
  136. package/lib/commonjs/TemplateItem.js.map +1 -0
  137. package/lib/commonjs/TemplateValue.js +68 -0
  138. package/lib/commonjs/TemplateValue.js.map +1 -0
  139. package/lib/commonjs/Utils.js +20 -0
  140. package/lib/commonjs/Utils.js.map +1 -0
  141. package/lib/commonjs/Wishlist.js +290 -0
  142. package/lib/commonjs/Wishlist.js.map +1 -0
  143. package/lib/commonjs/WishlistContext.js +17 -0
  144. package/lib/commonjs/WishlistContext.js.map +1 -0
  145. package/lib/commonjs/WishlistData.js +149 -0
  146. package/lib/commonjs/WishlistData.js.map +1 -0
  147. package/lib/commonjs/WishlistDataCopy.js +115 -0
  148. package/lib/commonjs/WishlistDataCopy.js.map +1 -0
  149. package/lib/commonjs/WishlistJsRuntime.android.js +22 -0
  150. package/lib/commonjs/WishlistJsRuntime.android.js.map +1 -0
  151. package/lib/commonjs/WishlistJsRuntime.js +42 -0
  152. package/lib/commonjs/WishlistJsRuntime.js.map +1 -0
  153. package/lib/commonjs/createTemplateComponent.js +196 -0
  154. package/lib/commonjs/createTemplateComponent.js.map +1 -0
  155. package/lib/commonjs/global.d.js +2 -0
  156. package/lib/commonjs/global.d.js.map +1 -0
  157. package/lib/commonjs/index.js +83 -0
  158. package/lib/commonjs/index.js.map +1 -0
  159. package/lib/commonjs/package.json +1 -0
  160. package/lib/commonjs/renderTemplate.js +14 -0
  161. package/lib/commonjs/renderTemplate.js.map +1 -0
  162. package/lib/module/Colors.js +395 -0
  163. package/lib/module/Colors.js.map +1 -0
  164. package/lib/module/ComponentPool.js +24 -0
  165. package/lib/module/ComponentPool.js.map +1 -0
  166. package/lib/module/Components/ForEach.js +17 -0
  167. package/lib/module/Components/ForEach.js.map +1 -0
  168. package/lib/module/Components/ForEachBase.js +14 -0
  169. package/lib/module/Components/ForEachBase.js.map +1 -0
  170. package/lib/module/Components/IF.js +29 -0
  171. package/lib/module/Components/IF.js.map +1 -0
  172. package/lib/module/Components/Pressable.js +68 -0
  173. package/lib/module/Components/Pressable.js.map +1 -0
  174. package/lib/module/Components/Switch.js +45 -0
  175. package/lib/module/Components/Switch.js.map +1 -0
  176. package/lib/module/Components/WishlistImage.js +25 -0
  177. package/lib/module/Components/WishlistImage.js.map +1 -0
  178. package/lib/module/Components/WishlistText.js +20 -0
  179. package/lib/module/Components/WishlistText.js.map +1 -0
  180. package/lib/module/Components/WishlistView.js +6 -0
  181. package/lib/module/Components/WishlistView.js.map +1 -0
  182. package/lib/module/EventHandler.js +66 -0
  183. package/lib/module/EventHandler.js.map +1 -0
  184. package/lib/module/InflatorRepository.js +149 -0
  185. package/lib/module/InflatorRepository.js.map +1 -0
  186. package/lib/module/OrchestratorBinding.js +8 -0
  187. package/lib/module/OrchestratorBinding.js.map +1 -0
  188. package/lib/module/Specs/NativeContentContainer.js +7 -0
  189. package/lib/module/Specs/NativeContentContainer.js.map +1 -0
  190. package/lib/module/Specs/NativeTemplateContainer.js +7 -0
  191. package/lib/module/Specs/NativeTemplateContainer.js.map +1 -0
  192. package/lib/module/Specs/NativeTemplateInterceptor.js +5 -0
  193. package/lib/module/Specs/NativeTemplateInterceptor.js.map +1 -0
  194. package/lib/module/Specs/NativeWishlist.js +11 -0
  195. package/lib/module/Specs/NativeWishlist.js.map +1 -0
  196. package/lib/module/Specs/NativeWishlistManager.js +5 -0
  197. package/lib/module/Specs/NativeWishlistManager.js.map +1 -0
  198. package/lib/module/TemplateContext.js +12 -0
  199. package/lib/module/TemplateContext.js.map +1 -0
  200. package/lib/module/TemplateItem.js +2 -0
  201. package/lib/module/TemplateItem.js.map +1 -0
  202. package/lib/module/TemplateValue.js +63 -0
  203. package/lib/module/TemplateValue.js.map +1 -0
  204. package/lib/module/Utils.js +15 -0
  205. package/lib/module/Utils.js.map +1 -0
  206. package/lib/module/Wishlist.js +284 -0
  207. package/lib/module/Wishlist.js.map +1 -0
  208. package/lib/module/WishlistContext.js +12 -0
  209. package/lib/module/WishlistContext.js.map +1 -0
  210. package/lib/module/WishlistData.js +144 -0
  211. package/lib/module/WishlistData.js.map +1 -0
  212. package/lib/module/WishlistDataCopy.js +111 -0
  213. package/lib/module/WishlistDataCopy.js.map +1 -0
  214. package/lib/module/WishlistJsRuntime.android.js +16 -0
  215. package/lib/module/WishlistJsRuntime.android.js.map +1 -0
  216. package/lib/module/WishlistJsRuntime.js +35 -0
  217. package/lib/module/WishlistJsRuntime.js.map +1 -0
  218. package/lib/module/createTemplateComponent.js +191 -0
  219. package/lib/module/createTemplateComponent.js.map +1 -0
  220. package/lib/module/global.d.js +2 -0
  221. package/lib/module/global.d.js.map +1 -0
  222. package/lib/module/index.js +14 -0
  223. package/lib/module/index.js.map +1 -0
  224. package/lib/module/renderTemplate.js +10 -0
  225. package/lib/module/renderTemplate.js.map +1 -0
  226. package/lib/typescript/Colors.d.ts +7 -0
  227. package/lib/typescript/Colors.d.ts.map +1 -0
  228. package/lib/typescript/ComponentPool.d.ts +10 -0
  229. package/lib/typescript/ComponentPool.d.ts.map +1 -0
  230. package/lib/typescript/Components/ForEach.d.ts +2 -0
  231. package/lib/typescript/Components/ForEach.d.ts.map +1 -0
  232. package/lib/typescript/Components/ForEachBase.d.ts +3 -0
  233. package/lib/typescript/Components/ForEachBase.d.ts.map +1 -0
  234. package/lib/typescript/Components/IF.d.ts +3 -0
  235. package/lib/typescript/Components/IF.d.ts.map +1 -0
  236. package/lib/typescript/Components/Pressable.d.ts +15 -0
  237. package/lib/typescript/Components/Pressable.d.ts.map +1 -0
  238. package/lib/typescript/Components/Switch.d.ts +17 -0
  239. package/lib/typescript/Components/Switch.d.ts.map +1 -0
  240. package/lib/typescript/Components/WishlistImage.d.ts +3 -0
  241. package/lib/typescript/Components/WishlistImage.d.ts.map +1 -0
  242. package/lib/typescript/Components/WishlistText.d.ts +3 -0
  243. package/lib/typescript/Components/WishlistText.d.ts.map +1 -0
  244. package/lib/typescript/Components/WishlistView.d.ts +3 -0
  245. package/lib/typescript/Components/WishlistView.d.ts.map +1 -0
  246. package/lib/typescript/EventHandler.d.ts +9 -0
  247. package/lib/typescript/EventHandler.d.ts.map +1 -0
  248. package/lib/typescript/InflatorRepository.d.ts +28 -0
  249. package/lib/typescript/InflatorRepository.d.ts.map +1 -0
  250. package/lib/typescript/OrchestratorBinding.d.ts +13 -0
  251. package/lib/typescript/OrchestratorBinding.d.ts.map +1 -0
  252. package/lib/typescript/Specs/NativeContentContainer.d.ts +6 -0
  253. package/lib/typescript/Specs/NativeContentContainer.d.ts.map +1 -0
  254. package/lib/typescript/Specs/NativeTemplateContainer.d.ts +9 -0
  255. package/lib/typescript/Specs/NativeTemplateContainer.d.ts.map +1 -0
  256. package/lib/typescript/Specs/NativeTemplateInterceptor.d.ts +6 -0
  257. package/lib/typescript/Specs/NativeTemplateInterceptor.d.ts.map +1 -0
  258. package/lib/typescript/Specs/NativeWishlist.d.ts +22 -0
  259. package/lib/typescript/Specs/NativeWishlist.d.ts.map +1 -0
  260. package/lib/typescript/Specs/NativeWishlistManager.d.ts +7 -0
  261. package/lib/typescript/Specs/NativeWishlistManager.d.ts.map +1 -0
  262. package/lib/typescript/TemplateContext.d.ts +9 -0
  263. package/lib/typescript/TemplateContext.d.ts.map +1 -0
  264. package/lib/typescript/TemplateItem.d.ts +13 -0
  265. package/lib/typescript/TemplateItem.d.ts.map +1 -0
  266. package/lib/typescript/TemplateValue.d.ts +16 -0
  267. package/lib/typescript/TemplateValue.d.ts.map +1 -0
  268. package/lib/typescript/Utils.d.ts +3 -0
  269. package/lib/typescript/Utils.d.ts.map +1 -0
  270. package/lib/typescript/Wishlist.d.ts +59 -0
  271. package/lib/typescript/Wishlist.d.ts.map +1 -0
  272. package/lib/typescript/WishlistContext.d.ts +11 -0
  273. package/lib/typescript/WishlistContext.d.ts.map +1 -0
  274. package/lib/typescript/WishlistData.d.ts +20 -0
  275. package/lib/typescript/WishlistData.d.ts.map +1 -0
  276. package/lib/typescript/WishlistDataCopy.d.ts +25 -0
  277. package/lib/typescript/WishlistDataCopy.d.ts.map +1 -0
  278. package/lib/typescript/WishlistJsRuntime.android.d.ts +4 -0
  279. package/lib/typescript/WishlistJsRuntime.android.d.ts.map +1 -0
  280. package/lib/typescript/WishlistJsRuntime.d.ts +6 -0
  281. package/lib/typescript/WishlistJsRuntime.d.ts.map +1 -0
  282. package/lib/typescript/createTemplateComponent.d.ts +35 -0
  283. package/lib/typescript/createTemplateComponent.d.ts.map +1 -0
  284. package/lib/typescript/index.d.ts +8 -0
  285. package/lib/typescript/index.d.ts.map +1 -0
  286. package/lib/typescript/renderTemplate.d.ts +3 -0
  287. package/lib/typescript/renderTemplate.d.ts.map +1 -0
  288. package/package.json +195 -0
  289. package/src/Colors.ts +474 -0
  290. package/src/ComponentPool.ts +33 -0
  291. package/src/Components/ForEach.tsx +22 -0
  292. package/src/Components/ForEachBase.tsx +8 -0
  293. package/src/Components/IF.tsx +20 -0
  294. package/src/Components/Pressable.tsx +111 -0
  295. package/src/Components/Switch.tsx +49 -0
  296. package/src/Components/WishlistImage.tsx +25 -0
  297. package/src/Components/WishlistText.tsx +14 -0
  298. package/src/Components/WishlistView.tsx +4 -0
  299. package/src/EventHandler.ts +78 -0
  300. package/src/InflatorRepository.ts +231 -0
  301. package/src/OrchestratorBinding.ts +15 -0
  302. package/src/Specs/NativeContentContainer.ts +9 -0
  303. package/src/Specs/NativeTemplateContainer.ts +13 -0
  304. package/src/Specs/NativeTemplateInterceptor.ts +8 -0
  305. package/src/Specs/NativeWishlist.ts +42 -0
  306. package/src/Specs/NativeWishlistManager.ts +7 -0
  307. package/src/TemplateContext.tsx +14 -0
  308. package/src/TemplateItem.ts +15 -0
  309. package/src/TemplateValue.tsx +101 -0
  310. package/src/Utils.ts +15 -0
  311. package/src/Wishlist.tsx +417 -0
  312. package/src/WishlistContext.tsx +15 -0
  313. package/src/WishlistData.ts +179 -0
  314. package/src/WishlistDataCopy.ts +138 -0
  315. package/src/WishlistJsRuntime.android.ts +20 -0
  316. package/src/WishlistJsRuntime.ts +59 -0
  317. package/src/createTemplateComponent.tsx +263 -0
  318. package/src/global.d.ts +1 -0
  319. package/src/index.ts +17 -0
  320. package/src/renderTemplate.ts +22 -0
@@ -0,0 +1,319 @@
1
+ #import "MGWishlistManager.h"
2
+
3
+ #import <objc/runtime.h>
4
+ #import <React/RCTBridge+Private.h>
5
+ #import <React/RCTBridge.h>
6
+ #import <React/RCTComponentViewFactory.h>
7
+ #import <React/RCTScheduler.h>
8
+ #import <React/RCTSurfacePresenter.h>
9
+ #import <React/RCTSurfacePresenterStub.h>
10
+ #import <ReactCommon/RCTTurboModule.h>
11
+ #include <jsi/JSIDynamic.h>
12
+ #include <jsi/jsi.h>
13
+ #include <react/renderer/components/view/ViewEventEmitter.h>
14
+ #include <react/renderer/core/EventListener.h>
15
+ #include <react/renderer/core/ShadowNodeFamily.h>
16
+ #include "WKTJsiWorkletContext.h"
17
+ #include "MGContentContainerComponent.h"
18
+ #include "MGObjCJSIUtils.h"
19
+ #include "MGTemplateContainerComponent.h"
20
+ #include "MGTemplateInterceptorComponent.h"
21
+ #include "MGUIManagerHolder.h"
22
+ #import "MGWishListComponent.h"
23
+ #import "MGWishlistQueue.h"
24
+ #include "WishlistJsRuntime.h"
25
+
26
+ using namespace facebook::react;
27
+ using namespace Wishlist;
28
+
29
+ @interface MGWishlistManager () <RCTEventDispatcherObserver>
30
+
31
+ @property (nonatomic, weak) RCTBridge *bridge;
32
+
33
+ @end
34
+
35
+ @implementation MGWishlistManager {
36
+ __weak RCTSurfacePresenter *_surfacePresenter;
37
+ std::shared_ptr<EventListener> _eventListener;
38
+ dispatch_queue_t _wishlistQueue;
39
+ }
40
+
41
+ RCT_EXPORT_MODULE(WishlistManager);
42
+
43
+ + (void)initialize
44
+ {
45
+ if (self != [MGWishlistManager class]) {
46
+ return;
47
+ }
48
+ RCTComponentViewFactory *factory = [RCTComponentViewFactory currentComponentViewFactory];
49
+ [factory registerComponentViewClass:[MGWishListComponent class]];
50
+ [factory registerComponentViewClass:[MGTemplateContainerComponent class]];
51
+ [factory registerComponentViewClass:[MGTemplateInterceptorComponent class]];
52
+ [factory registerComponentViewClass:[MGContentContainerComponent class]];
53
+ }
54
+
55
+ - (void)setBridge:(RCTBridge *)bridge
56
+ {
57
+ _bridge = bridge;
58
+ __weak __typeof(self) weakSelf = self;
59
+ _eventListener = std::make_shared<EventListener>([weakSelf](const RawEvent &event) -> bool {
60
+ __typeof(self) strongSelf = weakSelf;
61
+ if (!strongSelf) {
62
+ return false;
63
+ }
64
+ return [strongSelf handleFabricEvent:event];
65
+ });
66
+ // In bridgeless mode the real surface presenter arrives via
67
+ // `setSurfacePresenter:` — the eventListener and UIManager hook-up happen
68
+ // there. In the legacy bridge path we still see a usable presenter here.
69
+ RCTSurfacePresenter *presenter = (RCTSurfacePresenter *)_bridge.surfacePresenter;
70
+ if ([presenter isKindOfClass:[RCTSurfacePresenter class]]) {
71
+ _surfacePresenter = presenter;
72
+ [_surfacePresenter.scheduler addEventListener:_eventListener];
73
+ MGUIManagerHolder::getInstance().setUIManager(_surfacePresenter.scheduler.uiManager);
74
+ }
75
+
76
+ [[bridge.moduleRegistry moduleForName:"EventDispatcher" lazilyLoadIfNecessary:YES] addDispatchObserver:self];
77
+ }
78
+
79
+ - (void)installWishlistRuntime
80
+ {
81
+ RCTCxxBridge *cxxBridge = (RCTCxxBridge *)_bridge;
82
+ auto callInvoker = cxxBridge.jsCallInvoker;
83
+ facebook::jsi::Runtime *jsRuntime = (facebook::jsi::Runtime *)cxxBridge.runtime;
84
+
85
+ // Install a JSI helper that lets the JS side hand us the
86
+ // `react-native-worklets-core` context (created via `Worklets.createContext`)
87
+ // it intends wishlist to run on. We unwrap the C++ `JsiWorkletContext`
88
+ // shared_ptr from the host object and use its worklet runtime as
89
+ // `WishlistJsRuntime`, so native and JS share global state. Without this the
90
+ // registry/handlers installed by the worklet context are invisible to
91
+ // wishlist's native code.
92
+ auto setupWishlistRuntime = [callInvoker](
93
+ facebook::jsi::Runtime &rt,
94
+ const facebook::jsi::Value & /*thisVal*/,
95
+ const facebook::jsi::Value *args,
96
+ size_t count) -> facebook::jsi::Value {
97
+ if (count < 1 || !args[0].isObject()) {
98
+ throw facebook::jsi::JSError(
99
+ rt, "MGWishlistManager._setWishlistContext expects a worklet context");
100
+ }
101
+ auto hostObject = args[0].asObject(rt).asHostObject(rt);
102
+ auto context = std::dynamic_pointer_cast<RNWorklet::JsiWorkletContext>(hostObject);
103
+ if (!context) {
104
+ throw facebook::jsi::JSError(
105
+ rt, "MGWishlistManager._setWishlistContext: argument is not a JsiWorkletContext");
106
+ }
107
+ facebook::jsi::Runtime &workletRuntime = context->getWorkletRuntime();
108
+ auto contextWeak = std::weak_ptr<RNWorklet::JsiWorkletContext>(context);
109
+ Wishlist::WishlistJsRuntime::getInstance().initialize(
110
+ &workletRuntime,
111
+ [=](std::function<void()> &&f) { callInvoker->invokeAsync(std::move(f)); },
112
+ [=](std::function<void()> &&f) {
113
+ __block auto retainedWork = std::move(f);
114
+ MGExecuteOnWishlistQueue(^{
115
+ retainedWork();
116
+ });
117
+ },
118
+ [contextWeak](std::function<void(facebook::jsi::Runtime &)> &&job) {
119
+ if (auto ctx = contextWeak.lock()) {
120
+ ctx->invokeOnWorkletThread(
121
+ [job = std::move(job)](RNWorklet::JsiWorkletContext * /*c*/,
122
+ facebook::jsi::Runtime &rt) { job(rt); });
123
+ }
124
+ });
125
+ return facebook::jsi::Value::undefined();
126
+ };
127
+
128
+ jsRuntime->global().setProperty(
129
+ *jsRuntime,
130
+ "__mgWishlistSetContext",
131
+ facebook::jsi::Function::createFromHostFunction(
132
+ *jsRuntime,
133
+ facebook::jsi::PropNameID::forAscii(*jsRuntime, "__mgWishlistSetContext"),
134
+ 1,
135
+ setupWishlistRuntime));
136
+
137
+ // In bridgeless mode RN sets the real surface presenter on us via
138
+ // `setSurfacePresenter:` (separately from `setBridge:`), which also seeds
139
+ // `MGUIManagerHolder`. Capture again here as a fallback for the legacy
140
+ // bridge path — the scheduler's uiManager is finally wired up by the time
141
+ // JS reaches `install()`.
142
+ if (_surfacePresenter != nil) {
143
+ if (MGUIManagerHolder::getInstance().getUIManager() == nullptr) {
144
+ MGUIManagerHolder::getInstance().setUIManager(_surfacePresenter.scheduler.uiManager);
145
+ }
146
+ }
147
+ }
148
+
149
+ - (void)eventDispatcherWillDispatchEvent:(id<RCTEvent>)event
150
+ {
151
+ [self handlePaperEvent:event];
152
+ }
153
+
154
+ - (bool)handleFabricEvent:(const RawEvent &)event
155
+ {
156
+ std::string type = event.type;
157
+
158
+ auto shadowNodeFamily = event.shadowNodeFamily.lock();
159
+ if (shadowNodeFamily == nullptr) {
160
+ return event.eventTarget != nullptr;
161
+ }
162
+
163
+ int tag = shadowNodeFamily->getTag();
164
+ if (tag >= 0) {
165
+ // Some RN 0.83 Fabric events can have no instance handle. If we let those
166
+ // continue through the default event queue, RN crashes when retaining the
167
+ // target or mixing the JS `target` into the payload.
168
+ return shadowNodeFamily->getInstanceHandle() == nullptr;
169
+ }
170
+
171
+ if (event.eventTarget == nullptr) {
172
+ return false;
173
+ }
174
+
175
+ auto eventPayload = event.eventPayload;
176
+ WishlistJsRuntime::getInstance().accessRuntime([=](jsi::Runtime &rt) {
177
+ jsi::Value payload = eventPayload ? eventPayload->asJSIValue(rt) : jsi::Value::null();
178
+ [self sendEventWithType:jsi::String::createFromUtf8(rt, type) tag:tag payload:payload];
179
+ });
180
+
181
+ return true;
182
+ }
183
+
184
+ - (void)handlePaperEvent:(id<RCTEvent>)event
185
+ {
186
+ NSNumber *tag = event.viewTag;
187
+ NSString *type = event.eventName;
188
+
189
+ WishlistJsRuntime::getInstance().accessRuntime([=](jsi::Runtime &rt) {
190
+ [self sendEventWithType:jsi::String::createFromUtf8(rt, [type UTF8String])
191
+ tag:tag.intValue
192
+ payload:convertObjCObjectToJSIValue(rt, event.arguments[2])];
193
+ });
194
+ }
195
+
196
+ - (void)sendEventWithType:(const jsi::String &)type tag:(int)tag payload:(const jsi::Value &)payload
197
+ {
198
+ auto &rt = WishlistJsRuntime::getInstance().getRuntime();
199
+ try {
200
+ auto global = rt.global().getPropertyAsObject(rt, "global");
201
+ if (global.hasProperty(rt, "handleEvent")) {
202
+ auto f = global.getPropertyAsFunction(rt, "handleEvent");
203
+ f.call(rt, type, tag, payload);
204
+ }
205
+ } catch (std::exception &error) {
206
+ RCTLogError(@"%@", [NSString stringWithUTF8String:error.what()]);
207
+ }
208
+ }
209
+
210
+ - (void)initialize
211
+ {
212
+ }
213
+
214
+ // In bridgeless mode RN calls this method on the TurboModule with the
215
+ // real surface presenter (the one set on `RCTBridge` is unusable here). We
216
+ // keep this reference and re-attach the wishlist event listener / refresh the
217
+ // cached UIManager.
218
+ - (void)setSurfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
219
+ {
220
+ _surfacePresenter = (RCTSurfacePresenter *)surfacePresenter;
221
+
222
+ // Ensure the event listener exists (setBridge: may not have set it up under
223
+ // bridgeless mode).
224
+ if (_eventListener == nullptr) {
225
+ __weak __typeof(self) weakSelf = self;
226
+ _eventListener = std::make_shared<EventListener>([weakSelf](const RawEvent &event) -> bool {
227
+ __typeof(self) strongSelf = weakSelf;
228
+ if (!strongSelf) {
229
+ return false;
230
+ }
231
+ return [strongSelf handleFabricEvent:event];
232
+ });
233
+ }
234
+
235
+ RCTScheduler *scheduler = _surfacePresenter.scheduler;
236
+ if (scheduler != nil) {
237
+ [scheduler addEventListener:_eventListener];
238
+ MGUIManagerHolder::getInstance().setUIManager(scheduler.uiManager);
239
+ }
240
+ }
241
+
242
+ - (void)invalidate
243
+ {
244
+ [_surfacePresenter.scheduler removeEventListener:_eventListener];
245
+ }
246
+
247
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
248
+ {
249
+ // Wire up `WishlistJsRuntime` to the worklets UI runtime now that JS has
250
+ // started (so `globalThis.__workletsModuleProxy` is available). This must
251
+ // happen before any wishlist component mounts.
252
+ [self installWishlistRuntime];
253
+ return @true;
254
+ }
255
+
256
+ - (std::shared_ptr<TurboModule>)getTurboModule:(const ObjCTurboModule::InitParams &)params
257
+ {
258
+ return std::make_shared<NativeWishlistManagerSpecJSI>(params);
259
+ }
260
+
261
+ @end
262
+
263
+ @implementation MGWishlistComponentManager
264
+
265
+ RCT_EXPORT_MODULE(MGWishlist)
266
+
267
+ RCT_CUSTOM_VIEW_PROPERTY(inflatorId, NSString *, UIView) {}
268
+ RCT_CUSTOM_VIEW_PROPERTY(initialIndex, double, UIView) {}
269
+
270
+ RCT_EXPORT_VIEW_PROPERTY(onStartReached, RCTDirectEventBlock)
271
+ RCT_EXPORT_VIEW_PROPERTY(onEndReached, RCTDirectEventBlock)
272
+
273
+ - (UIView *)view
274
+ {
275
+ return [[UIView alloc] init];
276
+ }
277
+
278
+ @end
279
+
280
+ @implementation MGTemplateContainerManager
281
+
282
+ RCT_EXPORT_MODULE(MGTemplateContainer)
283
+
284
+ RCT_CUSTOM_VIEW_PROPERTY(inflatorId, NSString *, UIView) {}
285
+
286
+ RCT_CUSTOM_VIEW_PROPERTY(wishlistId, NSString *, UIView) {}
287
+
288
+ RCT_CUSTOM_VIEW_PROPERTY(names, NSArray<NSString *> *, UIView) {}
289
+
290
+ - (UIView *)view
291
+ {
292
+ return [[UIView alloc] init];
293
+ }
294
+
295
+ @end
296
+
297
+ @implementation MGTemplateInterceptorManager
298
+
299
+ RCT_EXPORT_MODULE(MGTemplateInterceptor)
300
+
301
+ RCT_CUSTOM_VIEW_PROPERTY(inflatorId, NSString *, UIView) {}
302
+
303
+ - (UIView *)view
304
+ {
305
+ return [[UIView alloc] init];
306
+ }
307
+
308
+ @end
309
+
310
+ @implementation MGContentContainerManager
311
+
312
+ RCT_EXPORT_MODULE(MGContentContainerManager)
313
+
314
+ - (UIView *)view
315
+ {
316
+ return [[UIView alloc] init];
317
+ }
318
+
319
+ @end
@@ -0,0 +1,11 @@
1
+ #import <React/RCTDefines.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ RCT_EXTERN dispatch_queue_t MGGetWishlistQueue(void);
6
+
7
+ RCT_EXTERN BOOL MGIsWishlistQueue(void);
8
+
9
+ RCT_EXTERN void MGExecuteOnWishlistQueue(dispatch_block_t block);
10
+
11
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,34 @@
1
+ #import "MGWishlistQueue.h"
2
+
3
+ dispatch_queue_t MGGetWishlistQueue(void)
4
+ {
5
+ static dispatch_queue_t wishlistQueue;
6
+ static dispatch_once_t onceToken;
7
+ dispatch_once(&onceToken, ^{
8
+ dispatch_queue_attr_t qos =
9
+ dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, -1);
10
+ wishlistQueue = dispatch_queue_create("wishlistqueue", qos);
11
+ });
12
+ return wishlistQueue;
13
+ }
14
+
15
+ BOOL MGIsWishlistQueue(void)
16
+ {
17
+ static void *wishlistQueueKey = &wishlistQueueKey;
18
+ static dispatch_once_t onceToken;
19
+ dispatch_once(&onceToken, ^{
20
+ dispatch_queue_set_specific(MGGetWishlistQueue(), wishlistQueueKey, wishlistQueueKey, NULL);
21
+ });
22
+ return dispatch_get_specific(wishlistQueueKey) == wishlistQueueKey;
23
+ }
24
+
25
+ void MGExecuteOnWishlistQueue(dispatch_block_t block)
26
+ {
27
+ if (MGIsWishlistQueue()) {
28
+ block();
29
+ } else {
30
+ dispatch_async(MGGetWishlistQueue(), ^{
31
+ block();
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,35 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <react/renderer/components/wishlist/Props.h>
3
+ #import <react/renderer/components/wishlist/ShadowNodes.h>
4
+ #import <memory>
5
+ #import <string>
6
+ #import <vector>
7
+ #import "MGDI.hpp"
8
+ #import "MGViewportCarerImpl.h"
9
+
10
+ NS_ASSUME_NONNULL_BEGIN
11
+
12
+ using namespace Wishlist;
13
+
14
+ @class MGWishListComponent;
15
+
16
+ @interface MGOrchestrator : NSObject
17
+
18
+ - (instancetype)initWith:(MGWishListComponent *)wishlist
19
+ wishlistId:(std::string)wishlistId
20
+ viewportCarer:(std::shared_ptr<MGViewportCarerImpl>)viewportCarer;
21
+
22
+ - (void)renderAsyncWithDimensions:(MGDims)dimensions
23
+ initialContentSize:(CGFloat)initialContentSize
24
+ initialIndex:(NSInteger)initialIndex
25
+ templates:(std::vector<std::shared_ptr<facebook::react::ShadowNode const>>)templates
26
+ names:(std::vector<std::string>)names
27
+ inflatorId:(std::string)inflatorId;
28
+ - (void)didScrollAsyncWithDimensions:(MGDims)dimensions
29
+ contentOffset:(float)contentOffset
30
+ inflatorId:(std::string)inflatorId;
31
+ - (void)scrollToItem:(int)index;
32
+
33
+ @end
34
+
35
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,139 @@
1
+ #import "MGOrchestrator.h"
2
+
3
+ #include <set>
4
+ #include "MGDIImpl.hpp"
5
+ #include "MGDataBindingImpl.hpp"
6
+ #include "MGErrorHandlerIOS.h"
7
+ #include "MGOrchestratorCppAdapter.hpp"
8
+ #include "MGUIScheduleriOS.hpp"
9
+ #include "MGViewportCarerImpl.h"
10
+ #include "MGWishListComponent.h"
11
+ #include "WishlistJsRuntime.h"
12
+
13
+ using namespace Wishlist;
14
+
15
+ @implementation MGOrchestrator {
16
+ MGWishListComponent *_wishlist;
17
+ std::shared_ptr<MGDIImpl> _di;
18
+ std::string _inflatorId;
19
+ std::string _wishlistId;
20
+ MGDims _dimensions;
21
+ BOOL _alreadyRendered;
22
+ std::shared_ptr<MGOrchestratorCppAdapter> _adapter;
23
+ std::vector<Item> _items;
24
+ int _pendingScrollToItem;
25
+ }
26
+
27
+ - (instancetype)initWith:(MGWishListComponent *)wishlist
28
+ wishlistId:(std::string)wishlistId
29
+ viewportCarer:(std::shared_ptr<MGViewportCarerImpl>)viewportCarer
30
+ {
31
+ if (self = [super init]) {
32
+ _wishlist = wishlist;
33
+ _wishlistId = wishlistId;
34
+ _alreadyRendered = NO;
35
+ _pendingScrollToItem = -1;
36
+ _di = std::make_shared<MGDIImpl>();
37
+ auto weakDI = std::weak_ptr<MGDIImpl>(_di);
38
+ viewportCarer->setDI(_di);
39
+ _di->setViewportCarer(viewportCarer);
40
+
41
+ __weak __typeof(self) weakSelf = self;
42
+ _adapter = std::make_shared<MGOrchestratorCppAdapter>(
43
+ [weakSelf]() { [weakSelf handleVSync]; },
44
+ [weakSelf](std::vector<Item> items) { [weakSelf didPushChildren:std::move(items)]; });
45
+ _di->setVSyncRequester(_adapter);
46
+ _di->setDataBinding(std::make_shared<MGDataBindingImpl>(_wishlistId, weakDI));
47
+ _di->setUIScheduler(std::make_shared<MGUIScheduleriOS>());
48
+ _di->setErrorHandler(std::make_shared<MGErrorHandlerIOS>());
49
+
50
+ viewportCarer->setListener(std::weak_ptr(_adapter));
51
+ }
52
+ return self;
53
+ }
54
+
55
+ - (void)handleVSync
56
+ {
57
+ _di->getViewportCarer()->didScrollAsync(_dimensions, MG_NO_OFFSET, _inflatorId);
58
+ }
59
+
60
+ - (void)renderAsyncWithDimensions:(MGDims)dimensions
61
+ initialContentSize:(CGFloat)initialContentSize
62
+ initialIndex:(NSInteger)initialIndex
63
+ templates:(std::vector<std::shared_ptr<facebook::react::ShadowNode const>>)templates
64
+ names:(std::vector<std::string>)names
65
+ inflatorId:(std::string)inflatorId
66
+ {
67
+ if (!_alreadyRendered && names.size() > 0 && names.size() == templates.size()) {
68
+ _alreadyRendered = YES;
69
+ _dimensions = dimensions;
70
+ _inflatorId = inflatorId;
71
+ _di->getViewportCarer()->initialRenderAsync(
72
+ dimensions, initialContentSize, initialIndex, templates, names, inflatorId);
73
+ } else {
74
+ _dimensions = dimensions;
75
+ _inflatorId = inflatorId;
76
+ [self handleVSync];
77
+ }
78
+ }
79
+
80
+ - (void)didScrollAsyncWithDimensions:(MGDims)dimensions
81
+ contentOffset:(float)contentOffset
82
+ inflatorId:(std::string)inflatorId
83
+ {
84
+ _dimensions = dimensions;
85
+ _inflatorId = inflatorId;
86
+ _di->getViewportCarer()->didScrollAsync(dimensions, contentOffset, inflatorId);
87
+ }
88
+ - (void)notifyAboutNewTemplates:(std::vector<std::shared_ptr<facebook::react::ShadowNode const>>)templates
89
+ withNames:(std::vector<std::string>)names
90
+ inflatorId:(std::string)inflatorId
91
+ {
92
+ _inflatorId = inflatorId;
93
+ [self handleVSync];
94
+ }
95
+
96
+ - (void)scrollToItem:(int)index
97
+ {
98
+ float offset = -1;
99
+ for (auto &item : _items) {
100
+ if (item.index == index) {
101
+ offset = item.offset;
102
+ break;
103
+ }
104
+ }
105
+
106
+ if (offset == -1) {
107
+ _pendingScrollToItem = index;
108
+ bool isBelow = _items.back().index < index;
109
+ // TODO: Implement proper animation for items outside the window.
110
+ if (isBelow) {
111
+ [self scrollToOffset:_items.back().offset + 10000];
112
+ } else {
113
+ [self scrollToOffset:_items.back().offset - 10000];
114
+ }
115
+ } else {
116
+ _pendingScrollToItem = -1;
117
+ [self scrollToOffset:offset];
118
+ }
119
+ }
120
+
121
+ - (void)scrollToOffset:(float)offset
122
+ {
123
+ [_wishlist.scrollView setContentOffset:{0, offset} animated:YES];
124
+ }
125
+
126
+ - (void)didPushChildren:(std::vector<Item>)items
127
+ {
128
+ _items = std::move(items);
129
+ if (_pendingScrollToItem != -1) {
130
+ [self scrollToItem:_pendingScrollToItem];
131
+ }
132
+ }
133
+
134
+ - (void)dealloc
135
+ {
136
+ _wishlist = nil;
137
+ }
138
+
139
+ @end
@@ -0,0 +1,25 @@
1
+ //
2
+ // MGOrchestratorCppAdapter.cpp
3
+ // CocoaAsyncSocket
4
+ //
5
+ // Created by Szymon on 14/01/2023.
6
+ //
7
+
8
+ #include "MGOrchestratorCppAdapter.hpp"
9
+
10
+ namespace Wishlist {
11
+
12
+ MGOrchestratorCppAdapter::MGOrchestratorCppAdapter(
13
+ std::function<void()> onRequestVSync,
14
+ std::function<void(std::vector<Item> items)> didPushChildren)
15
+ : onRequestVSync_(onRequestVSync), didPushChildren_(didPushChildren) {}
16
+
17
+ void MGOrchestratorCppAdapter::didPushChildren(std::vector<Item> newWindow) {
18
+ didPushChildren_(std::move(newWindow));
19
+ }
20
+
21
+ void MGOrchestratorCppAdapter::requestVSync() {
22
+ onRequestVSync_();
23
+ }
24
+
25
+ }; // namespace Wishlist
@@ -0,0 +1,32 @@
1
+ //
2
+ // MGOrchestratorCppAdapter.hpp
3
+ // CocoaAsyncSocket
4
+ //
5
+ // Created by Szymon on 14/01/2023.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #include <stdio.h>
11
+ #include <functional>
12
+ #include "MGVSyncRequester.hpp"
13
+ #include "MGViewportCarerListener.hpp"
14
+
15
+ namespace Wishlist {
16
+
17
+ class MGOrchestratorCppAdapter final : public MGVSyncRequester,
18
+ public MGViewportCarerListener {
19
+ public:
20
+ MGOrchestratorCppAdapter(
21
+ std::function<void()> onRequestVSync,
22
+ std::function<void(std::vector<Item> items)> didPushChildren);
23
+
24
+ private:
25
+ void didPushChildren(std::vector<Item> newWindow) override;
26
+ void requestVSync() override;
27
+
28
+ std::function<void()> onRequestVSync_;
29
+ std::function<void(std::vector<Item> items)> didPushChildren_;
30
+ };
31
+
32
+ }; // namespace Wishlist
@@ -0,0 +1,19 @@
1
+ //
2
+ // MGUIScheduleriOS.hpp
3
+ // CocoaAsyncSocket
4
+ //
5
+ // Created by Szymon on 14/01/2023.
6
+ //
7
+
8
+ #pragma once
9
+
10
+ #include <stdio.h>
11
+ #include "MGUIScheduler.hpp"
12
+
13
+ namespace Wishlist {
14
+
15
+ struct MGUIScheduleriOS : MGUIScheduler {
16
+ virtual void scheduleOnUI(std::function<void()> &&f);
17
+ };
18
+
19
+ }; // namespace Wishlist
@@ -0,0 +1,21 @@
1
+ //
2
+ // MGUIScheduleriOS.cpp
3
+ // CocoaAsyncSocket
4
+ //
5
+ // Created by Szymon on 14/01/2023.
6
+ //
7
+
8
+ #import "MGUIScheduleriOS.hpp"
9
+ #import <React/RCTUtils.h>
10
+
11
+ namespace Wishlist {
12
+
13
+ void MGUIScheduleriOS::scheduleOnUI(std::function<void()> &&f)
14
+ {
15
+ __block auto retainedWork = std::move(f);
16
+ RCTExecuteOnMainQueue(^{
17
+ retainedWork();
18
+ });
19
+ };
20
+
21
+ }; // namespace Wishlist