@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.
- package/LICENSE +20 -0
- package/MGWishList.podspec +40 -0
- package/README.md +281 -0
- package/android/CMakeLists.txt +86 -0
- package/android/build.gradle +72 -0
- package/android/gradle.properties +5 -0
- package/android/spotless.gradle +24 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/wishlist/ContentContainer.kt +22 -0
- package/android/src/main/java/com/wishlist/Orchestrator.kt +38 -0
- package/android/src/main/java/com/wishlist/TemplateContainer.kt +30 -0
- package/android/src/main/java/com/wishlist/TemplateContainerViewManager.kt +65 -0
- package/android/src/main/java/com/wishlist/TemplateInterceptor.kt +29 -0
- package/android/src/main/java/com/wishlist/TemplateInterceptorViewManager.kt +23 -0
- package/android/src/main/java/com/wishlist/UIScheduler.kt +15 -0
- package/android/src/main/java/com/wishlist/Wishlist.kt +135 -0
- package/android/src/main/java/com/wishlist/WishlistManagerModule.kt +51 -0
- package/android/src/main/java/com/wishlist/WishlistPackage.kt +47 -0
- package/android/src/main/java/com/wishlist/WishlistSoLoader.kt +17 -0
- package/android/src/main/java/com/wishlist/WishlistViewManager.kt +69 -0
- package/android/src/main/jni/ErrorHandlerAndroid.cpp +16 -0
- package/android/src/main/jni/ErrorHandlerAndroid.h +13 -0
- package/android/src/main/jni/JNIStateRegistry.cpp +22 -0
- package/android/src/main/jni/JNIStateRegistry.h +23 -0
- package/android/src/main/jni/OnLoad.cpp +12 -0
- package/android/src/main/jni/Orchestrator.cpp +167 -0
- package/android/src/main/jni/Orchestrator.hpp +78 -0
- package/android/src/main/jni/UISchedulerAndroid.cpp +20 -0
- package/android/src/main/jni/UISchedulerAndroid.h +18 -0
- package/android/src/main/jni/WishlistManagerModule.cpp +91 -0
- package/android/src/main/jni/WishlistManagerModule.hpp +43 -0
- package/android/src/main/jni/wishlist.h +19 -0
- package/cpp/ContentContainer/MGContentContainerComponentDescriptor.h +40 -0
- package/cpp/ContentContainer/MGContentContainerShadowNode.cpp +21 -0
- package/cpp/ContentContainer/MGContentContainerShadowNode.h +30 -0
- package/cpp/ContentContainer/MGContentContainerState.cpp +31 -0
- package/cpp/ContentContainer/MGContentContainerState.h +39 -0
- package/cpp/DataBinding/MGBindingProvider.hpp +21 -0
- package/cpp/DataBinding/MGDataBinding.hpp +23 -0
- package/cpp/DataBinding/MGDataBindingImpl.cpp +112 -0
- package/cpp/DataBinding/MGDataBindingImpl.hpp +35 -0
- package/cpp/DependencyInjection/MGDI.hpp +33 -0
- package/cpp/DependencyInjection/MGDIImpl.cpp +65 -0
- package/cpp/DependencyInjection/MGDIImpl.hpp +45 -0
- package/cpp/DependencyInjection/MGUIManagerHolder.cpp +21 -0
- package/cpp/DependencyInjection/MGUIManagerHolder.h +24 -0
- package/cpp/ItemProvider/ComponentsPool.cpp +91 -0
- package/cpp/ItemProvider/ComponentsPool.h +49 -0
- package/cpp/ItemProvider/ItemProvider.cpp +60 -0
- package/cpp/ItemProvider/ItemProvider.h +67 -0
- package/cpp/ItemProvider/ShadowNodeBinding.cpp +356 -0
- package/cpp/ItemProvider/ShadowNodeBinding.h +59 -0
- package/cpp/ItemProvider/ShadowNodeCopyMachine.cpp +95 -0
- package/cpp/ItemProvider/ShadowNodeCopyMachine.h +25 -0
- package/cpp/MGErrorHandler.h +12 -0
- package/cpp/MGViewportCarer/MGVSyncRequester.hpp +18 -0
- package/cpp/MGViewportCarer/MGViewportCarer.hpp +42 -0
- package/cpp/MGViewportCarer/MGViewportCarerImpl.cpp +453 -0
- package/cpp/MGViewportCarer/MGViewportCarerImpl.h +80 -0
- package/cpp/MGViewportCarer/MGViewportCarerListener.hpp +27 -0
- package/cpp/TemplateContainer/MGTemplateContainerComponentDescriptor.h +15 -0
- package/cpp/TemplateContainer/MGTemplateContainerShadowNode.cpp +43 -0
- package/cpp/TemplateContainer/MGTemplateContainerShadowNode.h +42 -0
- package/cpp/TemplateContainer/MGTemplateContainerState.cpp +37 -0
- package/cpp/TemplateContainer/MGTemplateContainerState.h +39 -0
- package/cpp/UIScheduler/MGUIScheduler.cpp +8 -0
- package/cpp/UIScheduler/MGUIScheduler.hpp +18 -0
- package/cpp/Wishlist/MGWishlistComponentDescriptor.h +14 -0
- package/cpp/Wishlist/MGWishlistShadowNode.cpp +49 -0
- package/cpp/Wishlist/MGWishlistShadowNode.h +37 -0
- package/cpp/Wishlist/MGWishlistState.cpp +57 -0
- package/cpp/Wishlist/MGWishlistState.h +42 -0
- package/cpp/WishlistDefine.h +3 -0
- package/cpp/WishlistJsRuntime.cpp +139 -0
- package/cpp/WishlistJsRuntime.h +59 -0
- package/ios/MGContentContainerComponent.h +9 -0
- package/ios/MGContentContainerComponent.mm +34 -0
- package/ios/MGErrorHandlerIOS.h +13 -0
- package/ios/MGErrorHandlerIOS.mm +12 -0
- package/ios/MGObjCJSIUtils.h +63 -0
- package/ios/MGTemplateContainerComponent.h +12 -0
- package/ios/MGTemplateContainerComponent.mm +105 -0
- package/ios/MGTemplateInterceptorComponent.h +9 -0
- package/ios/MGTemplateInterceptorComponent.mm +72 -0
- package/ios/MGWishListComponent.h +17 -0
- package/ios/MGWishListComponent.mm +187 -0
- package/ios/MGWishlistManager.h +21 -0
- package/ios/MGWishlistManager.mm +319 -0
- package/ios/MGWishlistQueue.h +11 -0
- package/ios/MGWishlistQueue.m +34 -0
- package/ios/Orchestrator/MGOrchestrator.h +35 -0
- package/ios/Orchestrator/MGOrchestrator.mm +139 -0
- package/ios/Orchestrator/MGOrchestratorCppAdapter.cpp +25 -0
- package/ios/Orchestrator/MGOrchestratorCppAdapter.hpp +32 -0
- package/ios/UIScheduleriOS/MGUIScheduleriOS.hpp +19 -0
- package/ios/UIScheduleriOS/MGUIScheduleriOS.mm +21 -0
- package/lib/commonjs/Colors.js +399 -0
- package/lib/commonjs/Colors.js.map +1 -0
- package/lib/commonjs/ComponentPool.js +28 -0
- package/lib/commonjs/ComponentPool.js.map +1 -0
- package/lib/commonjs/Components/ForEach.js +21 -0
- package/lib/commonjs/Components/ForEach.js.map +1 -0
- package/lib/commonjs/Components/ForEachBase.js +19 -0
- package/lib/commonjs/Components/ForEachBase.js.map +1 -0
- package/lib/commonjs/Components/IF.js +34 -0
- package/lib/commonjs/Components/IF.js.map +1 -0
- package/lib/commonjs/Components/Pressable.js +73 -0
- package/lib/commonjs/Components/Pressable.js.map +1 -0
- package/lib/commonjs/Components/Switch.js +52 -0
- package/lib/commonjs/Components/Switch.js.map +1 -0
- package/lib/commonjs/Components/WishlistImage.js +29 -0
- package/lib/commonjs/Components/WishlistImage.js.map +1 -0
- package/lib/commonjs/Components/WishlistText.js +24 -0
- package/lib/commonjs/Components/WishlistText.js.map +1 -0
- package/lib/commonjs/Components/WishlistView.js +10 -0
- package/lib/commonjs/Components/WishlistView.js.map +1 -0
- package/lib/commonjs/EventHandler.js +72 -0
- package/lib/commonjs/EventHandler.js.map +1 -0
- package/lib/commonjs/InflatorRepository.js +155 -0
- package/lib/commonjs/InflatorRepository.js.map +1 -0
- package/lib/commonjs/OrchestratorBinding.js +12 -0
- package/lib/commonjs/OrchestratorBinding.js.map +1 -0
- package/lib/commonjs/Specs/NativeContentContainer.js +12 -0
- package/lib/commonjs/Specs/NativeContentContainer.js.map +1 -0
- package/lib/commonjs/Specs/NativeTemplateContainer.js +12 -0
- package/lib/commonjs/Specs/NativeTemplateContainer.js.map +1 -0
- package/lib/commonjs/Specs/NativeTemplateInterceptor.js +10 -0
- package/lib/commonjs/Specs/NativeTemplateInterceptor.js.map +1 -0
- package/lib/commonjs/Specs/NativeWishlist.js +16 -0
- package/lib/commonjs/Specs/NativeWishlist.js.map +1 -0
- package/lib/commonjs/Specs/NativeWishlistManager.js +9 -0
- package/lib/commonjs/Specs/NativeWishlistManager.js.map +1 -0
- package/lib/commonjs/TemplateContext.js +17 -0
- package/lib/commonjs/TemplateContext.js.map +1 -0
- package/lib/commonjs/TemplateItem.js +2 -0
- package/lib/commonjs/TemplateItem.js.map +1 -0
- package/lib/commonjs/TemplateValue.js +68 -0
- package/lib/commonjs/TemplateValue.js.map +1 -0
- package/lib/commonjs/Utils.js +20 -0
- package/lib/commonjs/Utils.js.map +1 -0
- package/lib/commonjs/Wishlist.js +290 -0
- package/lib/commonjs/Wishlist.js.map +1 -0
- package/lib/commonjs/WishlistContext.js +17 -0
- package/lib/commonjs/WishlistContext.js.map +1 -0
- package/lib/commonjs/WishlistData.js +149 -0
- package/lib/commonjs/WishlistData.js.map +1 -0
- package/lib/commonjs/WishlistDataCopy.js +115 -0
- package/lib/commonjs/WishlistDataCopy.js.map +1 -0
- package/lib/commonjs/WishlistJsRuntime.android.js +22 -0
- package/lib/commonjs/WishlistJsRuntime.android.js.map +1 -0
- package/lib/commonjs/WishlistJsRuntime.js +42 -0
- package/lib/commonjs/WishlistJsRuntime.js.map +1 -0
- package/lib/commonjs/createTemplateComponent.js +196 -0
- package/lib/commonjs/createTemplateComponent.js.map +1 -0
- package/lib/commonjs/global.d.js +2 -0
- package/lib/commonjs/global.d.js.map +1 -0
- package/lib/commonjs/index.js +83 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/renderTemplate.js +14 -0
- package/lib/commonjs/renderTemplate.js.map +1 -0
- package/lib/module/Colors.js +395 -0
- package/lib/module/Colors.js.map +1 -0
- package/lib/module/ComponentPool.js +24 -0
- package/lib/module/ComponentPool.js.map +1 -0
- package/lib/module/Components/ForEach.js +17 -0
- package/lib/module/Components/ForEach.js.map +1 -0
- package/lib/module/Components/ForEachBase.js +14 -0
- package/lib/module/Components/ForEachBase.js.map +1 -0
- package/lib/module/Components/IF.js +29 -0
- package/lib/module/Components/IF.js.map +1 -0
- package/lib/module/Components/Pressable.js +68 -0
- package/lib/module/Components/Pressable.js.map +1 -0
- package/lib/module/Components/Switch.js +45 -0
- package/lib/module/Components/Switch.js.map +1 -0
- package/lib/module/Components/WishlistImage.js +25 -0
- package/lib/module/Components/WishlistImage.js.map +1 -0
- package/lib/module/Components/WishlistText.js +20 -0
- package/lib/module/Components/WishlistText.js.map +1 -0
- package/lib/module/Components/WishlistView.js +6 -0
- package/lib/module/Components/WishlistView.js.map +1 -0
- package/lib/module/EventHandler.js +66 -0
- package/lib/module/EventHandler.js.map +1 -0
- package/lib/module/InflatorRepository.js +149 -0
- package/lib/module/InflatorRepository.js.map +1 -0
- package/lib/module/OrchestratorBinding.js +8 -0
- package/lib/module/OrchestratorBinding.js.map +1 -0
- package/lib/module/Specs/NativeContentContainer.js +7 -0
- package/lib/module/Specs/NativeContentContainer.js.map +1 -0
- package/lib/module/Specs/NativeTemplateContainer.js +7 -0
- package/lib/module/Specs/NativeTemplateContainer.js.map +1 -0
- package/lib/module/Specs/NativeTemplateInterceptor.js +5 -0
- package/lib/module/Specs/NativeTemplateInterceptor.js.map +1 -0
- package/lib/module/Specs/NativeWishlist.js +11 -0
- package/lib/module/Specs/NativeWishlist.js.map +1 -0
- package/lib/module/Specs/NativeWishlistManager.js +5 -0
- package/lib/module/Specs/NativeWishlistManager.js.map +1 -0
- package/lib/module/TemplateContext.js +12 -0
- package/lib/module/TemplateContext.js.map +1 -0
- package/lib/module/TemplateItem.js +2 -0
- package/lib/module/TemplateItem.js.map +1 -0
- package/lib/module/TemplateValue.js +63 -0
- package/lib/module/TemplateValue.js.map +1 -0
- package/lib/module/Utils.js +15 -0
- package/lib/module/Utils.js.map +1 -0
- package/lib/module/Wishlist.js +284 -0
- package/lib/module/Wishlist.js.map +1 -0
- package/lib/module/WishlistContext.js +12 -0
- package/lib/module/WishlistContext.js.map +1 -0
- package/lib/module/WishlistData.js +144 -0
- package/lib/module/WishlistData.js.map +1 -0
- package/lib/module/WishlistDataCopy.js +111 -0
- package/lib/module/WishlistDataCopy.js.map +1 -0
- package/lib/module/WishlistJsRuntime.android.js +16 -0
- package/lib/module/WishlistJsRuntime.android.js.map +1 -0
- package/lib/module/WishlistJsRuntime.js +35 -0
- package/lib/module/WishlistJsRuntime.js.map +1 -0
- package/lib/module/createTemplateComponent.js +191 -0
- package/lib/module/createTemplateComponent.js.map +1 -0
- package/lib/module/global.d.js +2 -0
- package/lib/module/global.d.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/renderTemplate.js +10 -0
- package/lib/module/renderTemplate.js.map +1 -0
- package/lib/typescript/Colors.d.ts +7 -0
- package/lib/typescript/Colors.d.ts.map +1 -0
- package/lib/typescript/ComponentPool.d.ts +10 -0
- package/lib/typescript/ComponentPool.d.ts.map +1 -0
- package/lib/typescript/Components/ForEach.d.ts +2 -0
- package/lib/typescript/Components/ForEach.d.ts.map +1 -0
- package/lib/typescript/Components/ForEachBase.d.ts +3 -0
- package/lib/typescript/Components/ForEachBase.d.ts.map +1 -0
- package/lib/typescript/Components/IF.d.ts +3 -0
- package/lib/typescript/Components/IF.d.ts.map +1 -0
- package/lib/typescript/Components/Pressable.d.ts +15 -0
- package/lib/typescript/Components/Pressable.d.ts.map +1 -0
- package/lib/typescript/Components/Switch.d.ts +17 -0
- package/lib/typescript/Components/Switch.d.ts.map +1 -0
- package/lib/typescript/Components/WishlistImage.d.ts +3 -0
- package/lib/typescript/Components/WishlistImage.d.ts.map +1 -0
- package/lib/typescript/Components/WishlistText.d.ts +3 -0
- package/lib/typescript/Components/WishlistText.d.ts.map +1 -0
- package/lib/typescript/Components/WishlistView.d.ts +3 -0
- package/lib/typescript/Components/WishlistView.d.ts.map +1 -0
- package/lib/typescript/EventHandler.d.ts +9 -0
- package/lib/typescript/EventHandler.d.ts.map +1 -0
- package/lib/typescript/InflatorRepository.d.ts +28 -0
- package/lib/typescript/InflatorRepository.d.ts.map +1 -0
- package/lib/typescript/OrchestratorBinding.d.ts +13 -0
- package/lib/typescript/OrchestratorBinding.d.ts.map +1 -0
- package/lib/typescript/Specs/NativeContentContainer.d.ts +6 -0
- package/lib/typescript/Specs/NativeContentContainer.d.ts.map +1 -0
- package/lib/typescript/Specs/NativeTemplateContainer.d.ts +9 -0
- package/lib/typescript/Specs/NativeTemplateContainer.d.ts.map +1 -0
- package/lib/typescript/Specs/NativeTemplateInterceptor.d.ts +6 -0
- package/lib/typescript/Specs/NativeTemplateInterceptor.d.ts.map +1 -0
- package/lib/typescript/Specs/NativeWishlist.d.ts +22 -0
- package/lib/typescript/Specs/NativeWishlist.d.ts.map +1 -0
- package/lib/typescript/Specs/NativeWishlistManager.d.ts +7 -0
- package/lib/typescript/Specs/NativeWishlistManager.d.ts.map +1 -0
- package/lib/typescript/TemplateContext.d.ts +9 -0
- package/lib/typescript/TemplateContext.d.ts.map +1 -0
- package/lib/typescript/TemplateItem.d.ts +13 -0
- package/lib/typescript/TemplateItem.d.ts.map +1 -0
- package/lib/typescript/TemplateValue.d.ts +16 -0
- package/lib/typescript/TemplateValue.d.ts.map +1 -0
- package/lib/typescript/Utils.d.ts +3 -0
- package/lib/typescript/Utils.d.ts.map +1 -0
- package/lib/typescript/Wishlist.d.ts +59 -0
- package/lib/typescript/Wishlist.d.ts.map +1 -0
- package/lib/typescript/WishlistContext.d.ts +11 -0
- package/lib/typescript/WishlistContext.d.ts.map +1 -0
- package/lib/typescript/WishlistData.d.ts +20 -0
- package/lib/typescript/WishlistData.d.ts.map +1 -0
- package/lib/typescript/WishlistDataCopy.d.ts +25 -0
- package/lib/typescript/WishlistDataCopy.d.ts.map +1 -0
- package/lib/typescript/WishlistJsRuntime.android.d.ts +4 -0
- package/lib/typescript/WishlistJsRuntime.android.d.ts.map +1 -0
- package/lib/typescript/WishlistJsRuntime.d.ts +6 -0
- package/lib/typescript/WishlistJsRuntime.d.ts.map +1 -0
- package/lib/typescript/createTemplateComponent.d.ts +35 -0
- package/lib/typescript/createTemplateComponent.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/renderTemplate.d.ts +3 -0
- package/lib/typescript/renderTemplate.d.ts.map +1 -0
- package/package.json +195 -0
- package/src/Colors.ts +474 -0
- package/src/ComponentPool.ts +33 -0
- package/src/Components/ForEach.tsx +22 -0
- package/src/Components/ForEachBase.tsx +8 -0
- package/src/Components/IF.tsx +20 -0
- package/src/Components/Pressable.tsx +111 -0
- package/src/Components/Switch.tsx +49 -0
- package/src/Components/WishlistImage.tsx +25 -0
- package/src/Components/WishlistText.tsx +14 -0
- package/src/Components/WishlistView.tsx +4 -0
- package/src/EventHandler.ts +78 -0
- package/src/InflatorRepository.ts +231 -0
- package/src/OrchestratorBinding.ts +15 -0
- package/src/Specs/NativeContentContainer.ts +9 -0
- package/src/Specs/NativeTemplateContainer.ts +13 -0
- package/src/Specs/NativeTemplateInterceptor.ts +8 -0
- package/src/Specs/NativeWishlist.ts +42 -0
- package/src/Specs/NativeWishlistManager.ts +7 -0
- package/src/TemplateContext.tsx +14 -0
- package/src/TemplateItem.ts +15 -0
- package/src/TemplateValue.tsx +101 -0
- package/src/Utils.ts +15 -0
- package/src/Wishlist.tsx +417 -0
- package/src/WishlistContext.tsx +15 -0
- package/src/WishlistData.ts +179 -0
- package/src/WishlistDataCopy.ts +138 -0
- package/src/WishlistJsRuntime.android.ts +20 -0
- package/src/WishlistJsRuntime.ts +59 -0
- package/src/createTemplateComponent.tsx +263 -0
- package/src/global.d.ts +1 -0
- package/src/index.ts +17 -0
- package/src/renderTemplate.ts +22 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
4
|
+
#include <vector>
|
|
5
|
+
|
|
6
|
+
#ifdef ANDROID
|
|
7
|
+
#include <folly/dynamic.h>
|
|
8
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
namespace facebook {
|
|
13
|
+
namespace react {
|
|
14
|
+
|
|
15
|
+
class JSI_EXPORT MGTemplateContainerState final {
|
|
16
|
+
public:
|
|
17
|
+
MGTemplateContainerState(){};
|
|
18
|
+
MGTemplateContainerState(
|
|
19
|
+
std::vector<std::shared_ptr<ShadowNode const>> const &templates)
|
|
20
|
+
: templates_(templates){};
|
|
21
|
+
|
|
22
|
+
const std::vector<std::shared_ptr<ShadowNode const>> &getTemplates() const;
|
|
23
|
+
|
|
24
|
+
#ifdef ANDROID
|
|
25
|
+
MGTemplateContainerState(
|
|
26
|
+
MGTemplateContainerState const &previousState,
|
|
27
|
+
folly::dynamic data){};
|
|
28
|
+
|
|
29
|
+
folly::dynamic getDynamic() const;
|
|
30
|
+
|
|
31
|
+
MapBuffer getMapBuffer() const;
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
private:
|
|
35
|
+
std::vector<std::shared_ptr<ShadowNode const>> templates_;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
} // namespace react
|
|
39
|
+
} // namespace facebook
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MGUIScheduler.hpp
|
|
3
|
+
// CocoaAsyncSocket
|
|
4
|
+
//
|
|
5
|
+
// Created by Szymon on 14/01/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef MGUIScheduler_hpp
|
|
9
|
+
#define MGUIScheduler_hpp
|
|
10
|
+
|
|
11
|
+
#include <stdio.h>
|
|
12
|
+
#include <functional>
|
|
13
|
+
|
|
14
|
+
struct MGUIScheduler {
|
|
15
|
+
virtual void scheduleOnUI(std::function<void()> &&f) = 0;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
#endif /* MGUIScheduler_hpp */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
5
|
+
#include "MGWishlistShadowNode.h"
|
|
6
|
+
|
|
7
|
+
namespace facebook {
|
|
8
|
+
namespace react {
|
|
9
|
+
|
|
10
|
+
using MGWishlistComponentDescriptor =
|
|
11
|
+
ConcreteComponentDescriptor<MGWishlistShadowNode>;
|
|
12
|
+
|
|
13
|
+
} // namespace react
|
|
14
|
+
} // namespace facebook
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#include "MGWishlistShadowNode.h"
|
|
2
|
+
|
|
3
|
+
namespace facebook {
|
|
4
|
+
namespace react {
|
|
5
|
+
|
|
6
|
+
extern const char MGWishlistComponentName[] = "MGWishlist";
|
|
7
|
+
|
|
8
|
+
void MGWishlistShadowNode::layout(LayoutContext layoutContext) {
|
|
9
|
+
auto state = getStateData();
|
|
10
|
+
if (!state.initialised) {
|
|
11
|
+
state.initialised = true;
|
|
12
|
+
state.viewportCarer->setInitialValues(shared_from_this(), layoutContext);
|
|
13
|
+
|
|
14
|
+
setStateData(std::move(state));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ConcreteViewShadowNode::layout(layoutContext);
|
|
18
|
+
|
|
19
|
+
// TODO update viewportObserver if needed
|
|
20
|
+
|
|
21
|
+
updateStateIfNeeded();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void MGWishlistShadowNode::updateStateIfNeeded() {
|
|
25
|
+
ensureUnsealed();
|
|
26
|
+
|
|
27
|
+
auto contentBoundingRect = Rect{};
|
|
28
|
+
for (const auto &childNode : getLayoutableChildNodes()) {
|
|
29
|
+
contentBoundingRect.unionInPlace(childNode->getLayoutMetrics().frame);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
auto state = getStateData();
|
|
33
|
+
|
|
34
|
+
if (state.contentBoundingRect != contentBoundingRect) {
|
|
35
|
+
state.contentBoundingRect = contentBoundingRect;
|
|
36
|
+
setStateData(std::move(state));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void MGWishlistShadowNode::updateContentOffset(float contentOffset) {
|
|
41
|
+
ensureUnsealed();
|
|
42
|
+
|
|
43
|
+
auto state = getStateData();
|
|
44
|
+
state.contentOffset = contentOffset;
|
|
45
|
+
setStateData(std::move(state));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
} // namespace react
|
|
49
|
+
} // namespace facebook
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
5
|
+
#include <react/renderer/components/wishlist/EventEmitters.h>
|
|
6
|
+
#include <react/renderer/components/wishlist/Props.h>
|
|
7
|
+
#include <react/renderer/core/LayoutContext.h>
|
|
8
|
+
#include "MGWishlistState.h"
|
|
9
|
+
|
|
10
|
+
namespace facebook {
|
|
11
|
+
namespace react {
|
|
12
|
+
|
|
13
|
+
JSI_EXPORT extern const char MGWishlistComponentName[];
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* `ShadowNode` for <Wishlist> component.
|
|
17
|
+
*/
|
|
18
|
+
class JSI_EXPORT MGWishlistShadowNode
|
|
19
|
+
: public ConcreteViewShadowNode<
|
|
20
|
+
MGWishlistComponentName,
|
|
21
|
+
MGWishlistProps,
|
|
22
|
+
MGWishlistEventEmitter,
|
|
23
|
+
MGWishlistState>,
|
|
24
|
+
public std::enable_shared_from_this<MGWishlistShadowNode> {
|
|
25
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
void layout(LayoutContext layoutContext) override;
|
|
29
|
+
|
|
30
|
+
void updateContentOffset(float contentOffset);
|
|
31
|
+
|
|
32
|
+
private:
|
|
33
|
+
void updateStateIfNeeded();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
} // namespace react
|
|
37
|
+
} // namespace facebook
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#include "MGWishlistState.h"
|
|
2
|
+
|
|
3
|
+
#ifdef ANDROID
|
|
4
|
+
#include "JNIStateRegistry.h"
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
namespace facebook {
|
|
8
|
+
namespace react {
|
|
9
|
+
#ifdef ANDROID
|
|
10
|
+
namespace {
|
|
11
|
+
constexpr MapBuffer::Key ViewportCarerKey = 1;
|
|
12
|
+
constexpr MapBuffer::Key ContentOffsetKey = 2;
|
|
13
|
+
} // namespace
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
MGWishlistState::MGWishlistState()
|
|
17
|
+
: initialised(false),
|
|
18
|
+
viewportCarer(std::make_shared<MGViewportCarerImpl>()),
|
|
19
|
+
contentBoundingRect({}),
|
|
20
|
+
contentOffset(MG_NO_OFFSET){};
|
|
21
|
+
|
|
22
|
+
#ifdef ANDROID
|
|
23
|
+
|
|
24
|
+
MGWishlistState::MGWishlistState(
|
|
25
|
+
MGWishlistState const &previousState,
|
|
26
|
+
folly::dynamic data)
|
|
27
|
+
: initialised(previousState.initialised),
|
|
28
|
+
viewportCarer(previousState.viewportCarer),
|
|
29
|
+
contentBoundingRect(previousState.contentBoundingRect),
|
|
30
|
+
contentOffset(MG_NO_OFFSET){};
|
|
31
|
+
|
|
32
|
+
folly::dynamic MGWishlistState::getDynamic() const {
|
|
33
|
+
auto viewportCarerRef = Wishlist::JNIStateRegistry::getInstance().addValue(
|
|
34
|
+
(void *)&viewportCarer);
|
|
35
|
+
folly::dynamic result = folly::dynamic::object();
|
|
36
|
+
result["viewportCarer"] = viewportCarerRef;
|
|
37
|
+
if (contentOffset != MG_NO_OFFSET) {
|
|
38
|
+
result["contentOffset"] = contentOffset;
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
MapBuffer MGWishlistState::getMapBuffer() const {
|
|
44
|
+
auto viewportCarerRef = Wishlist::JNIStateRegistry::getInstance().addValue(
|
|
45
|
+
(void *)&viewportCarer);
|
|
46
|
+
MapBufferBuilder builder;
|
|
47
|
+
builder.putInt(ViewportCarerKey, viewportCarerRef);
|
|
48
|
+
if (contentOffset != MG_NO_OFFSET) {
|
|
49
|
+
builder.putDouble(ContentOffsetKey, contentOffset);
|
|
50
|
+
}
|
|
51
|
+
return builder.build();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
} // namespace react
|
|
57
|
+
} // namespace facebook
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
4
|
+
#include <react/renderer/graphics/Rect.h>
|
|
5
|
+
|
|
6
|
+
#ifdef ANDROID
|
|
7
|
+
#include <folly/dynamic.h>
|
|
8
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
9
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "ComponentsPool.h"
|
|
13
|
+
#include "MGViewportCarerImpl.h"
|
|
14
|
+
|
|
15
|
+
using namespace Wishlist;
|
|
16
|
+
|
|
17
|
+
namespace facebook {
|
|
18
|
+
namespace react {
|
|
19
|
+
|
|
20
|
+
// class WishlistShadowNode;
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* State for <ScrollView> component.
|
|
24
|
+
*/
|
|
25
|
+
class JSI_EXPORT MGWishlistState final {
|
|
26
|
+
public:
|
|
27
|
+
bool initialised;
|
|
28
|
+
std::shared_ptr<MGViewportCarerImpl> viewportCarer;
|
|
29
|
+
Rect contentBoundingRect;
|
|
30
|
+
float contentOffset;
|
|
31
|
+
|
|
32
|
+
MGWishlistState();
|
|
33
|
+
|
|
34
|
+
#ifdef ANDROID
|
|
35
|
+
MGWishlistState(MGWishlistState const &previousState, folly::dynamic data);
|
|
36
|
+
folly::dynamic getDynamic() const;
|
|
37
|
+
MapBuffer getMapBuffer() const;
|
|
38
|
+
#endif
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace react
|
|
42
|
+
} // namespace facebook
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#include "WishlistJsRuntime.h"
|
|
2
|
+
|
|
3
|
+
#include <chrono>
|
|
4
|
+
#include <iostream>
|
|
5
|
+
#include <mutex>
|
|
6
|
+
|
|
7
|
+
namespace Wishlist {
|
|
8
|
+
|
|
9
|
+
WishlistDispatchQueue::WishlistDispatchQueue() {
|
|
10
|
+
thread_ = std::thread([this]() {
|
|
11
|
+
while (true) {
|
|
12
|
+
std::function<void()> work;
|
|
13
|
+
{
|
|
14
|
+
std::unique_lock<std::mutex> lock(mutex_);
|
|
15
|
+
cv_.wait(lock, [this] { return quit_ || !queue_.empty(); });
|
|
16
|
+
if (quit_ && queue_.empty()) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
work = std::move(queue_.front());
|
|
20
|
+
queue_.pop();
|
|
21
|
+
}
|
|
22
|
+
work();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
WishlistDispatchQueue::~WishlistDispatchQueue() {
|
|
28
|
+
{
|
|
29
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
30
|
+
quit_ = true;
|
|
31
|
+
}
|
|
32
|
+
cv_.notify_all();
|
|
33
|
+
if (thread_.joinable()) {
|
|
34
|
+
thread_.join();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void WishlistDispatchQueue::dispatch(std::function<void()> work) {
|
|
39
|
+
{
|
|
40
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
41
|
+
queue_.push(std::move(work));
|
|
42
|
+
}
|
|
43
|
+
cv_.notify_one();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
WishlistJsRuntime &WishlistJsRuntime::getInstance() {
|
|
47
|
+
static WishlistJsRuntime instance;
|
|
48
|
+
return instance;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
WishlistJsRuntime::WishlistJsRuntime() : runtime_(nullptr) {}
|
|
52
|
+
|
|
53
|
+
void WishlistJsRuntime::initialize(
|
|
54
|
+
jsi::Runtime *runtime,
|
|
55
|
+
std::function<void(std::function<void()> &&)> jsCallInvoker,
|
|
56
|
+
std::function<void(std::function<void()> &&)> workletCallInvoker,
|
|
57
|
+
std::function<void(std::function<void(jsi::Runtime &)> &&)>
|
|
58
|
+
runtimeAccessor) {
|
|
59
|
+
runtime_ = runtime;
|
|
60
|
+
jsCallInvoker_ = std::move(jsCallInvoker);
|
|
61
|
+
workletCallInvoker_ = std::move(workletCallInvoker);
|
|
62
|
+
runtimeAccessor_ = std::move(runtimeAccessor);
|
|
63
|
+
|
|
64
|
+
decorateRuntime(*runtime_);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
jsi::Runtime &WishlistJsRuntime::getRuntime() const {
|
|
68
|
+
return *runtime_;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
void WishlistJsRuntime::accessRuntime(
|
|
72
|
+
std::function<void(jsi::Runtime &)> &&f) const {
|
|
73
|
+
if (runtimeAccessor_) {
|
|
74
|
+
runtimeAccessor_(std::move(f));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
auto runtime = runtime_;
|
|
78
|
+
auto ff = std::move(f);
|
|
79
|
+
jsCallInvoker_([runtime, ff = std::move(ff)]() mutable {
|
|
80
|
+
if (runtime) {
|
|
81
|
+
ff(*runtime);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void WishlistJsRuntime::accessRuntimeSync(
|
|
87
|
+
std::function<void(jsi::Runtime &)> &&f) const {
|
|
88
|
+
static std::mutex mutex;
|
|
89
|
+
mutex.lock();
|
|
90
|
+
auto runtime = runtime_;
|
|
91
|
+
auto ff = std::move(f);
|
|
92
|
+
jsCallInvoker_([runtime, ff = std::move(ff)]() mutable {
|
|
93
|
+
if (runtime) {
|
|
94
|
+
ff(*runtime);
|
|
95
|
+
}
|
|
96
|
+
mutex.unlock();
|
|
97
|
+
});
|
|
98
|
+
mutex.lock();
|
|
99
|
+
mutex.unlock();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void WishlistJsRuntime::decorateRuntime(jsi::Runtime &rt) {
|
|
103
|
+
auto callback = [](jsi::Runtime &rt,
|
|
104
|
+
const jsi::Value & /*thisValue*/,
|
|
105
|
+
const jsi::Value *args,
|
|
106
|
+
size_t /*count*/) -> jsi::Value {
|
|
107
|
+
const jsi::Value *value = &args[0];
|
|
108
|
+
if (value->isString()) {
|
|
109
|
+
std::cout << value->getString(rt).utf8(rt).c_str() << std::endl;
|
|
110
|
+
} else if (value->isNumber()) {
|
|
111
|
+
std::cout << value->getNumber() << std::endl;
|
|
112
|
+
} else if (value->isUndefined()) {
|
|
113
|
+
std::cout << "undefined" << std::endl;
|
|
114
|
+
} else {
|
|
115
|
+
std::cout << "unsupported value type" << std::endl;
|
|
116
|
+
}
|
|
117
|
+
return jsi::Value::undefined();
|
|
118
|
+
};
|
|
119
|
+
jsi::Value log = jsi::Function::createFromHostFunction(
|
|
120
|
+
rt, jsi::PropNameID::forAscii(rt, "_log"), 1, callback);
|
|
121
|
+
rt.global().setProperty(rt, "_log", log);
|
|
122
|
+
|
|
123
|
+
auto chronoNow = [](jsi::Runtime & /*rt*/,
|
|
124
|
+
const jsi::Value & /*thisValue*/,
|
|
125
|
+
const jsi::Value * /*args*/,
|
|
126
|
+
size_t /*count*/) -> jsi::Value {
|
|
127
|
+
double now = std::chrono::system_clock::now().time_since_epoch() /
|
|
128
|
+
std::chrono::milliseconds(1);
|
|
129
|
+
return jsi::Value(now);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
rt.global().setProperty(
|
|
133
|
+
rt,
|
|
134
|
+
"_chronoNow",
|
|
135
|
+
jsi::Function::createFromHostFunction(
|
|
136
|
+
rt, jsi::PropNameID::forAscii(rt, "_chronoNow"), 0, chronoNow));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <condition_variable>
|
|
5
|
+
#include <functional>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <mutex>
|
|
8
|
+
#include <queue>
|
|
9
|
+
#include <stdio.h>
|
|
10
|
+
#include <thread>
|
|
11
|
+
|
|
12
|
+
using namespace facebook;
|
|
13
|
+
|
|
14
|
+
namespace Wishlist {
|
|
15
|
+
|
|
16
|
+
class WishlistDispatchQueue {
|
|
17
|
+
public:
|
|
18
|
+
WishlistDispatchQueue();
|
|
19
|
+
~WishlistDispatchQueue();
|
|
20
|
+
|
|
21
|
+
void dispatch(std::function<void()> work);
|
|
22
|
+
|
|
23
|
+
private:
|
|
24
|
+
std::mutex mutex_;
|
|
25
|
+
std::condition_variable cv_;
|
|
26
|
+
std::queue<std::function<void()>> queue_;
|
|
27
|
+
bool quit_ = false;
|
|
28
|
+
std::thread thread_;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
class WishlistJsRuntime {
|
|
32
|
+
public:
|
|
33
|
+
static WishlistJsRuntime &getInstance();
|
|
34
|
+
|
|
35
|
+
void initialize(
|
|
36
|
+
jsi::Runtime *runtime,
|
|
37
|
+
std::function<void(std::function<void()> &&)> jsCallInvoker,
|
|
38
|
+
std::function<void(std::function<void()> &&)> workletCallInvoker,
|
|
39
|
+
std::function<void(std::function<void(jsi::Runtime &)> &&)>
|
|
40
|
+
runtimeAccessor = nullptr);
|
|
41
|
+
|
|
42
|
+
jsi::Runtime &getRuntime() const;
|
|
43
|
+
void accessRuntime(std::function<void(jsi::Runtime &rt)> &&f) const;
|
|
44
|
+
void accessRuntimeSync(std::function<void(jsi::Runtime &rt)> &&f) const;
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
WishlistJsRuntime();
|
|
48
|
+
WishlistJsRuntime(const WishlistJsRuntime &) = delete;
|
|
49
|
+
WishlistJsRuntime &operator=(const WishlistJsRuntime &) = delete;
|
|
50
|
+
|
|
51
|
+
void decorateRuntime(jsi::Runtime &runtime);
|
|
52
|
+
|
|
53
|
+
jsi::Runtime *runtime_;
|
|
54
|
+
std::function<void(std::function<void()> &&)> jsCallInvoker_;
|
|
55
|
+
std::function<void(std::function<void()> &&)> workletCallInvoker_;
|
|
56
|
+
std::function<void(std::function<void(jsi::Runtime &)> &&)> runtimeAccessor_;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#import "MGContentContainerComponent.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/wishlist/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/wishlist/Props.h>
|
|
5
|
+
#import "MGContentContainerComponentDescriptor.h"
|
|
6
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
7
|
+
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
@implementation MGContentContainerComponent
|
|
11
|
+
|
|
12
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
13
|
+
{
|
|
14
|
+
if (self = [super initWithFrame:frame]) {
|
|
15
|
+
static const auto defaultProps = std::make_shared<const MGContentContainerProps>();
|
|
16
|
+
_props = defaultProps;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return self;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#pragma mark - RCTComponentViewProtocol
|
|
23
|
+
|
|
24
|
+
+ (facebook::react::ComponentDescriptorProvider)componentDescriptorProvider
|
|
25
|
+
{
|
|
26
|
+
return facebook::react::concreteComponentDescriptorProvider<facebook::react::MGContentContainerComponentDescriptor>();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
Class<RCTComponentViewProtocol> MGContentContainerCls(void)
|
|
32
|
+
{
|
|
33
|
+
return MGContentContainerComponent.class;
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
|
|
5
|
+
using namespace facebook;
|
|
6
|
+
|
|
7
|
+
// Copied from RCTTurboModule.mm
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* All static helper functions are ObjC++ specific.
|
|
11
|
+
*/
|
|
12
|
+
static jsi::Value convertNSNumberToJSIBoolean(jsi::Runtime &runtime, NSNumber *value)
|
|
13
|
+
{
|
|
14
|
+
return jsi::Value((bool)[value boolValue]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static jsi::Value convertNSNumberToJSINumber(jsi::Runtime &runtime, NSNumber *value)
|
|
18
|
+
{
|
|
19
|
+
return jsi::Value([value doubleValue]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static jsi::String convertNSStringToJSIString(jsi::Runtime &runtime, NSString *value)
|
|
23
|
+
{
|
|
24
|
+
return jsi::String::createFromUtf8(runtime, [value UTF8String] ?: "");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value);
|
|
28
|
+
static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDictionary *value)
|
|
29
|
+
{
|
|
30
|
+
jsi::Object result = jsi::Object(runtime);
|
|
31
|
+
for (NSString *k in value) {
|
|
32
|
+
result.setProperty(runtime, [k UTF8String], convertObjCObjectToJSIValue(runtime, value[k]));
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static jsi::Array convertNSArrayToJSIArray(jsi::Runtime &runtime, NSArray *value)
|
|
38
|
+
{
|
|
39
|
+
jsi::Array result = jsi::Array(runtime, value.count);
|
|
40
|
+
for (size_t i = 0; i < value.count; i++) {
|
|
41
|
+
result.setValueAtIndex(runtime, i, convertObjCObjectToJSIValue(runtime, value[i]));
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static jsi::Value convertObjCObjectToJSIValue(jsi::Runtime &runtime, id value)
|
|
47
|
+
{
|
|
48
|
+
if ([value isKindOfClass:[NSString class]]) {
|
|
49
|
+
return convertNSStringToJSIString(runtime, (NSString *)value);
|
|
50
|
+
} else if ([value isKindOfClass:[NSNumber class]]) {
|
|
51
|
+
if ([value isKindOfClass:[@YES class]]) {
|
|
52
|
+
return convertNSNumberToJSIBoolean(runtime, (NSNumber *)value);
|
|
53
|
+
}
|
|
54
|
+
return convertNSNumberToJSINumber(runtime, (NSNumber *)value);
|
|
55
|
+
} else if ([value isKindOfClass:[NSDictionary class]]) {
|
|
56
|
+
return convertNSDictionaryToJSIObject(runtime, (NSDictionary *)value);
|
|
57
|
+
} else if ([value isKindOfClass:[NSArray class]]) {
|
|
58
|
+
return convertNSArrayToJSIArray(runtime, (NSArray *)value);
|
|
59
|
+
} else if (value == (id)kCFNull) {
|
|
60
|
+
return jsi::Value::null();
|
|
61
|
+
}
|
|
62
|
+
return jsi::Value::undefined();
|
|
63
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#import <React-RCTFabric/React/RCTViewComponentView.h>
|
|
2
|
+
#import "MGWishListComponent.h"
|
|
3
|
+
|
|
4
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
+
|
|
6
|
+
@interface MGTemplateContainerComponent : RCTViewComponentView
|
|
7
|
+
|
|
8
|
+
- (void)setWishlist:(MGWishListComponent *)wishList;
|
|
9
|
+
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_END
|