@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,356 @@
|
|
|
1
|
+
#include "ShadowNodeBinding.h"
|
|
2
|
+
|
|
3
|
+
#include "ComponentsPool.h"
|
|
4
|
+
|
|
5
|
+
#include <iostream>
|
|
6
|
+
|
|
7
|
+
using namespace facebook;
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
namespace Wishlist {
|
|
11
|
+
|
|
12
|
+
ShadowNodeBinding::ShadowNodeBinding(
|
|
13
|
+
std::shared_ptr<const ShadowNode> sn,
|
|
14
|
+
std::weak_ptr<ComponentsPool> wcp,
|
|
15
|
+
const std::string &type,
|
|
16
|
+
const std::string &key)
|
|
17
|
+
: sn_(sn), wcp_(wcp), parent_(nullptr), type_(type), key_(key) {}
|
|
18
|
+
|
|
19
|
+
ShadowNodeBinding::ShadowNodeBinding(
|
|
20
|
+
std::shared_ptr<const ShadowNode> sn,
|
|
21
|
+
std::weak_ptr<ComponentsPool> wcp,
|
|
22
|
+
std::shared_ptr<ShadowNodeBinding> parent)
|
|
23
|
+
: sn_(sn),
|
|
24
|
+
wcp_(wcp),
|
|
25
|
+
parent_(parent),
|
|
26
|
+
type_(parent->type_),
|
|
27
|
+
key_(parent->key_) {}
|
|
28
|
+
|
|
29
|
+
std::string ShadowNodeBinding::getType() const {
|
|
30
|
+
return type_;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
std::string ShadowNodeBinding::getKey() const {
|
|
34
|
+
return key_;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
std::shared_ptr<ShadowNode const> ShadowNodeBinding::getShadowNode() const {
|
|
38
|
+
return sn_;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
void ShadowNodeBinding::describe(
|
|
42
|
+
std::stringstream &ss,
|
|
43
|
+
const std::shared_ptr<const ShadowNode> n,
|
|
44
|
+
int level) {
|
|
45
|
+
for (auto i = 0; i < level; ++i) {
|
|
46
|
+
ss << " ";
|
|
47
|
+
}
|
|
48
|
+
ss << n->getComponentName();
|
|
49
|
+
if (n->getProps()->nativeId.length() > 0) {
|
|
50
|
+
ss << " (" << n->getProps()->nativeId << ")";
|
|
51
|
+
}
|
|
52
|
+
#if DEBUG
|
|
53
|
+
ss << " " << n->getProps()->getDebugDescription();
|
|
54
|
+
#endif
|
|
55
|
+
ss << "\n";
|
|
56
|
+
for (auto child : n->getChildren()) {
|
|
57
|
+
describe(ss, child, level + 2);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
std::shared_ptr<ShadowNodeBinding> ShadowNodeBinding::findNodeByWishId(
|
|
62
|
+
const std::string &nativeId,
|
|
63
|
+
std::shared_ptr<ShadowNodeBinding> p) {
|
|
64
|
+
for (auto child : p->sn_->getChildren()) {
|
|
65
|
+
// Create binding
|
|
66
|
+
auto bc = std::make_shared<ShadowNodeBinding>(child, wcp_, p);
|
|
67
|
+
|
|
68
|
+
// Test against native id
|
|
69
|
+
if (child->getProps()->nativeId == nativeId) {
|
|
70
|
+
return bc;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Test child's children
|
|
74
|
+
auto binding = findNodeByWishId(nativeId, bc);
|
|
75
|
+
if (binding != nullptr) {
|
|
76
|
+
return binding;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return nullptr;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
Value ShadowNodeBinding::get(Runtime &rt, const PropNameID &nameProp) {
|
|
83
|
+
std::string name = nameProp.utf8(rt);
|
|
84
|
+
|
|
85
|
+
if (name == "setCallback") {
|
|
86
|
+
return jsi::Function::createFromHostFunction(
|
|
87
|
+
rt,
|
|
88
|
+
nameProp,
|
|
89
|
+
1,
|
|
90
|
+
[=](jsi::Runtime &rt,
|
|
91
|
+
jsi::Value const &thisValue,
|
|
92
|
+
jsi::Value const *args,
|
|
93
|
+
size_t count) -> jsi::Value {
|
|
94
|
+
std::string callbackName = args[0].asString(rt).utf8(rt);
|
|
95
|
+
int tag = sn_->getTag();
|
|
96
|
+
std::string eventName = std::to_string(tag) + callbackName;
|
|
97
|
+
jsi::Function callback = args[1].asObject(rt).asFunction(rt);
|
|
98
|
+
|
|
99
|
+
auto handlerRegistry = rt.global()
|
|
100
|
+
.getPropertyAsObject(rt, "global")
|
|
101
|
+
.getPropertyAsObject(rt, "handlers");
|
|
102
|
+
handlerRegistry.setProperty(rt, eventName.c_str(), callback);
|
|
103
|
+
|
|
104
|
+
return jsi::Value::undefined();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (name == "addProps") {
|
|
109
|
+
return jsi::Function::createFromHostFunction(
|
|
110
|
+
rt,
|
|
111
|
+
nameProp,
|
|
112
|
+
1,
|
|
113
|
+
[=](jsi::Runtime &rt,
|
|
114
|
+
jsi::Value const &thisValue,
|
|
115
|
+
jsi::Value const *args,
|
|
116
|
+
size_t count) -> jsi::Value {
|
|
117
|
+
// TODO: Avoid this extra call into JS by wrapping this function in
|
|
118
|
+
// JS.
|
|
119
|
+
auto processProps =
|
|
120
|
+
rt.global()
|
|
121
|
+
.getPropertyAsObject(rt, "global")
|
|
122
|
+
.getPropertyAsObject(rt, "__wishlistInflatorRegistry")
|
|
123
|
+
.getPropertyAsFunction(rt, "processProps");
|
|
124
|
+
auto props = processProps.call(rt, args[0]);
|
|
125
|
+
RawProps rawProps(rt, props);
|
|
126
|
+
|
|
127
|
+
auto &cd = sn_->getComponentDescriptor();
|
|
128
|
+
|
|
129
|
+
PropsParserContext propsParserContext{
|
|
130
|
+
sn_->getFamily().getSurfaceId(), *cd.getContextContainer().get()};
|
|
131
|
+
|
|
132
|
+
auto nextProps = cd.cloneProps(
|
|
133
|
+
propsParserContext, sn_->getProps(), std::move(rawProps));
|
|
134
|
+
|
|
135
|
+
auto clonedShadowNode = cd.cloneShadowNode(
|
|
136
|
+
*sn_,
|
|
137
|
+
{
|
|
138
|
+
nextProps,
|
|
139
|
+
nullptr,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
sn_ = clonedShadowNode;
|
|
143
|
+
|
|
144
|
+
std::shared_ptr<ShadowNodeBinding> currentParent = parent_;
|
|
145
|
+
std::shared_ptr<ShadowNode> currentSN = clonedShadowNode;
|
|
146
|
+
while (currentParent != nullptr) {
|
|
147
|
+
auto &cd = currentParent->sn_->getComponentDescriptor();
|
|
148
|
+
auto children = currentParent->sn_->getChildren();
|
|
149
|
+
for (int i = 0; i < children.size(); ++i) {
|
|
150
|
+
if (children[i]->getTag() == currentSN->getTag()) {
|
|
151
|
+
children[i] = currentSN;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
currentSN = cd.cloneShadowNode(
|
|
156
|
+
*(currentParent->sn_),
|
|
157
|
+
{nullptr,
|
|
158
|
+
std::make_shared<std::vector<std::shared_ptr<const ShadowNode>>>(children)});
|
|
159
|
+
currentParent->sn_ = currentSN;
|
|
160
|
+
currentParent = currentParent->parent_;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return jsi::Value::undefined();
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (name == "setChildren") {
|
|
168
|
+
return jsi::Function::createFromHostFunction(
|
|
169
|
+
rt,
|
|
170
|
+
nameProp,
|
|
171
|
+
1,
|
|
172
|
+
[=](jsi::Runtime &rt,
|
|
173
|
+
jsi::Value const &thisValue,
|
|
174
|
+
jsi::Value const *args,
|
|
175
|
+
size_t count) -> jsi::Value {
|
|
176
|
+
if (!args[0].isObject() or !args[0].getObject(rt).isArray(rt)) {
|
|
177
|
+
return jsi::Value::undefined();
|
|
178
|
+
}
|
|
179
|
+
jsi::Array subItems = args[0].asObject(rt).asArray(rt);
|
|
180
|
+
|
|
181
|
+
auto &cd = sn_->getComponentDescriptor();
|
|
182
|
+
|
|
183
|
+
auto newChildren =
|
|
184
|
+
std::make_shared<std::vector<std::shared_ptr<const ShadowNode>>>();
|
|
185
|
+
|
|
186
|
+
for (int i = 0; i < subItems.size(rt); ++i) {
|
|
187
|
+
std::shared_ptr<ShadowNodeBinding> child =
|
|
188
|
+
subItems.getValueAtIndex(rt, i)
|
|
189
|
+
.getObject(rt)
|
|
190
|
+
.getHostObject<ShadowNodeBinding>(rt);
|
|
191
|
+
ShadowNodeCopyMachine::clearParent(child->sn_);
|
|
192
|
+
newChildren->push_back(child->sn_);
|
|
193
|
+
child->parent_ = shared_from_this();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
auto clonedShadowNode = cd.cloneShadowNode(
|
|
197
|
+
*sn_,
|
|
198
|
+
{
|
|
199
|
+
nullptr,
|
|
200
|
+
newChildren,
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
auto oldChildren = sn_->getChildren();
|
|
204
|
+
auto cp = wcp_.lock();
|
|
205
|
+
for (int i = 0; i < oldChildren.size(); ++i) {
|
|
206
|
+
if (cp) {
|
|
207
|
+
cp->returnToPool(oldChildren[i]);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
sn_ = clonedShadowNode;
|
|
212
|
+
|
|
213
|
+
std::shared_ptr<ShadowNodeBinding> currentParent = parent_;
|
|
214
|
+
std::shared_ptr<ShadowNode> currentSN = clonedShadowNode;
|
|
215
|
+
while (currentParent != nullptr) {
|
|
216
|
+
auto &cd = currentParent->sn_->getComponentDescriptor();
|
|
217
|
+
auto children = currentParent->sn_->getChildren();
|
|
218
|
+
for (int i = 0; i < children.size(); ++i) {
|
|
219
|
+
if (children[i]->getTag() == currentSN->getTag()) {
|
|
220
|
+
children[i] = currentSN;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
currentSN = cd.cloneShadowNode(
|
|
225
|
+
*(currentParent->sn_),
|
|
226
|
+
{nullptr,
|
|
227
|
+
std::make_shared<std::vector<std::shared_ptr<const ShadowNode>>>(children)});
|
|
228
|
+
currentParent->sn_ = currentSN;
|
|
229
|
+
currentParent = currentParent->parent_;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return jsi::Value::undefined();
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (name == "getName") {
|
|
237
|
+
return jsi::Function::createFromHostFunction(
|
|
238
|
+
rt,
|
|
239
|
+
nameProp,
|
|
240
|
+
1,
|
|
241
|
+
[=](jsi::Runtime &rt,
|
|
242
|
+
jsi::Value const &thisValue,
|
|
243
|
+
jsi::Value const *args,
|
|
244
|
+
size_t count) -> jsi::Value {
|
|
245
|
+
return jsi::String::createFromUtf8(rt, sn_->getComponentName());
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (name == "describe") {
|
|
250
|
+
return jsi::Function::createFromHostFunction(
|
|
251
|
+
rt,
|
|
252
|
+
nameProp,
|
|
253
|
+
1,
|
|
254
|
+
[=](jsi::Runtime &rt,
|
|
255
|
+
jsi::Value const &thisValue,
|
|
256
|
+
jsi::Value const *args,
|
|
257
|
+
size_t count) -> jsi::Value {
|
|
258
|
+
std::stringstream ss;
|
|
259
|
+
describe(ss, sn_, 0);
|
|
260
|
+
return jsi::String::createFromUtf8(rt, ss.str());
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (name == "getByWishId") { // TODO(Szymon) That can be optimised to O(depth)
|
|
265
|
+
// when template preprocessing
|
|
266
|
+
return jsi::Function::createFromHostFunction(
|
|
267
|
+
rt,
|
|
268
|
+
nameProp,
|
|
269
|
+
1,
|
|
270
|
+
[=](jsi::Runtime &rt,
|
|
271
|
+
jsi::Value const &thisValue,
|
|
272
|
+
jsi::Value const *args,
|
|
273
|
+
size_t count) -> jsi::Value {
|
|
274
|
+
auto binding = findNodeByWishId(
|
|
275
|
+
args[0].asString(rt).utf8(rt), shared_from_this());
|
|
276
|
+
if (binding != nullptr) {
|
|
277
|
+
return jsi::Object::createFromHostObject(rt, binding);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return jsi::Value::undefined();
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (name == "at") {
|
|
285
|
+
return jsi::Function::createFromHostFunction(
|
|
286
|
+
rt,
|
|
287
|
+
nameProp,
|
|
288
|
+
1,
|
|
289
|
+
[=](jsi::Runtime &rt,
|
|
290
|
+
jsi::Value const &thisValue,
|
|
291
|
+
jsi::Value const *args,
|
|
292
|
+
size_t count) -> jsi::Value {
|
|
293
|
+
int index = (int)(args[0].getNumber());
|
|
294
|
+
std::string type = sn_->getComponentName();
|
|
295
|
+
|
|
296
|
+
int i = 0;
|
|
297
|
+
|
|
298
|
+
for (auto sibiling : parent_->sn_->getChildren()) {
|
|
299
|
+
if (sibiling->getComponentName() == type) {
|
|
300
|
+
if (i == index) {
|
|
301
|
+
return jsi::Object::createFromHostObject(
|
|
302
|
+
rt,
|
|
303
|
+
std::make_shared<ShadowNodeBinding>(
|
|
304
|
+
sibiling, wcp_, parent_));
|
|
305
|
+
}
|
|
306
|
+
i++;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return jsi::Value::undefined();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (name == "getTag") {
|
|
315
|
+
return jsi::Function::createFromHostFunction(
|
|
316
|
+
rt,
|
|
317
|
+
nameProp,
|
|
318
|
+
0,
|
|
319
|
+
[=](jsi::Runtime &rt,
|
|
320
|
+
jsi::Value const &thisValue,
|
|
321
|
+
jsi::Value const *args,
|
|
322
|
+
size_t count) -> jsi::Value { return jsi::Value(sn_->getTag()); });
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (name == "key") {
|
|
326
|
+
return jsi::String::createFromUtf8(rt, key_);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (name == "type") {
|
|
330
|
+
return jsi::String::createFromUtf8(rt, type_);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
for (auto child : sn_->getChildren()) {
|
|
334
|
+
if (child->getComponentName() == name) {
|
|
335
|
+
return jsi::Object::createFromHostObject(
|
|
336
|
+
rt,
|
|
337
|
+
std::make_shared<ShadowNodeBinding>(child, wcp_, shared_from_this()));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return jsi::Value::undefined();
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
void ShadowNodeBinding::set(
|
|
345
|
+
Runtime &rt,
|
|
346
|
+
const PropNameID &name,
|
|
347
|
+
const Value &value) {
|
|
348
|
+
std::string str = name.utf8(rt);
|
|
349
|
+
if (str == "key") {
|
|
350
|
+
key_ = value.asString(rt).utf8(rt);
|
|
351
|
+
} else if (str == "type") {
|
|
352
|
+
type_ = value.asString(rt).utf8(rt);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
4
|
+
#include <stdio.h>
|
|
5
|
+
#include <map>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <sstream>
|
|
8
|
+
#include "ShadowNodeCopyMachine.h"
|
|
9
|
+
|
|
10
|
+
using namespace facebook;
|
|
11
|
+
using namespace facebook::react;
|
|
12
|
+
|
|
13
|
+
namespace Wishlist {
|
|
14
|
+
|
|
15
|
+
class ComponentsPool;
|
|
16
|
+
|
|
17
|
+
class ShadowNodeBinding
|
|
18
|
+
: public jsi::HostObject,
|
|
19
|
+
public std::enable_shared_from_this<ShadowNodeBinding> {
|
|
20
|
+
public:
|
|
21
|
+
ShadowNodeBinding(
|
|
22
|
+
std::shared_ptr<const ShadowNode> sn,
|
|
23
|
+
std::weak_ptr<ComponentsPool> wcp,
|
|
24
|
+
const std::string &type,
|
|
25
|
+
const std::string &key);
|
|
26
|
+
|
|
27
|
+
ShadowNodeBinding(
|
|
28
|
+
std::shared_ptr<const ShadowNode> sn,
|
|
29
|
+
std::weak_ptr<ComponentsPool> wcp,
|
|
30
|
+
std::shared_ptr<ShadowNodeBinding> parent);
|
|
31
|
+
|
|
32
|
+
virtual jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &nameProp);
|
|
33
|
+
|
|
34
|
+
virtual void
|
|
35
|
+
set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value);
|
|
36
|
+
|
|
37
|
+
std::string getType() const;
|
|
38
|
+
std::string getKey() const;
|
|
39
|
+
std::shared_ptr<ShadowNode const> getShadowNode() const;
|
|
40
|
+
|
|
41
|
+
private:
|
|
42
|
+
void describe(
|
|
43
|
+
std::stringstream &ss,
|
|
44
|
+
const std::shared_ptr<const ShadowNode> n,
|
|
45
|
+
int level);
|
|
46
|
+
|
|
47
|
+
std::shared_ptr<ShadowNodeBinding> findNodeByWishId(
|
|
48
|
+
const std::string &nativeId,
|
|
49
|
+
std::shared_ptr<ShadowNodeBinding> p);
|
|
50
|
+
|
|
51
|
+
private:
|
|
52
|
+
std::shared_ptr<const ShadowNode> sn_;
|
|
53
|
+
std::weak_ptr<ComponentsPool> wcp_;
|
|
54
|
+
std::shared_ptr<ShadowNodeBinding> parent_;
|
|
55
|
+
std::string type_;
|
|
56
|
+
std::string key_;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#include "ShadowNodeCopyMachine.h"
|
|
2
|
+
#include "MGWishlistComponentDescriptor.h"
|
|
3
|
+
#include "WishlistJsRuntime.h"
|
|
4
|
+
|
|
5
|
+
namespace Wishlist {
|
|
6
|
+
namespace {
|
|
7
|
+
|
|
8
|
+
// dirty hack don't do it at home
|
|
9
|
+
//
|
|
10
|
+
// NOTE: This mirrors the private layout of `facebook::react::ShadowNodeFamily`
|
|
11
|
+
// for React Native 0.83. We only use it via `reinterpret_cast` to reach the
|
|
12
|
+
// private `parent_`/`hasParent_` slots. RN 0.83 made `ShadowNodeFamily` derive
|
|
13
|
+
// from `jsi::NativeState` and moved `nativeProps_DEPRECATED` to a public field
|
|
14
|
+
// at the top of the class, so the order below differs from older versions of
|
|
15
|
+
// the library.
|
|
16
|
+
class ShadowNodeFamilyHack final : public jsi::NativeState {
|
|
17
|
+
public:
|
|
18
|
+
using Shared = std::shared_ptr<ShadowNodeFamily const>;
|
|
19
|
+
using Weak = std::weak_ptr<ShadowNodeFamily const>;
|
|
20
|
+
|
|
21
|
+
ShadowNodeFamilyHack() = delete;
|
|
22
|
+
|
|
23
|
+
mutable std::unique_ptr<folly::dynamic> nativeProps_DEPRECATED;
|
|
24
|
+
|
|
25
|
+
private:
|
|
26
|
+
[[maybe_unused]] EventDispatcher::Weak eventDispatcher_;
|
|
27
|
+
[[maybe_unused]] mutable std::shared_ptr<State const> mostRecentState_;
|
|
28
|
+
[[maybe_unused]] mutable std::shared_mutex mutex_;
|
|
29
|
+
[[maybe_unused]] mutable std::function<void(ShadowNodeFamily &family)>
|
|
30
|
+
onUnmountedFamilyDestroyedCallback_;
|
|
31
|
+
[[maybe_unused]] Tag const tag_;
|
|
32
|
+
[[maybe_unused]] SurfaceId const surfaceId_;
|
|
33
|
+
[[maybe_unused]] mutable InstanceHandle::Shared instanceHandle_;
|
|
34
|
+
[[maybe_unused]] SharedEventEmitter const eventEmitter_;
|
|
35
|
+
[[maybe_unused]] ComponentDescriptor const &componentDescriptor_;
|
|
36
|
+
[[maybe_unused]] ComponentHandle componentHandle_;
|
|
37
|
+
[[maybe_unused]] ComponentName componentName_;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
mutable ShadowNodeFamily::Weak parent_{};
|
|
41
|
+
mutable bool hasParent_{false};
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
[[maybe_unused]] mutable bool hasBeenMounted_{false};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
} // namespace
|
|
48
|
+
|
|
49
|
+
int tag = -2;
|
|
50
|
+
|
|
51
|
+
std::shared_ptr<ShadowNode> ShadowNodeCopyMachine::copyShadowSubtree(
|
|
52
|
+
const std::shared_ptr<const ShadowNode> &sn) {
|
|
53
|
+
auto const &cd = sn->getComponentDescriptor();
|
|
54
|
+
|
|
55
|
+
PropsParserContext propsParserContext{
|
|
56
|
+
sn->getSurfaceId(), *cd.getContextContainer().get()};
|
|
57
|
+
|
|
58
|
+
if (tag < -2e9) {
|
|
59
|
+
tag = -2;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
auto const fragment =
|
|
63
|
+
ShadowNodeFamilyFragment{tag -= 2, sn->getSurfaceId(), nullptr};
|
|
64
|
+
|
|
65
|
+
auto const family = cd.createFamily(fragment);
|
|
66
|
+
auto const props =
|
|
67
|
+
cd.cloneProps(propsParserContext, sn->getProps(), RawProps());
|
|
68
|
+
auto const state = cd.createInitialState(props, family);
|
|
69
|
+
|
|
70
|
+
auto shadowNode = cd.createShadowNode(
|
|
71
|
+
ShadowNodeFragment{
|
|
72
|
+
/* .props = */
|
|
73
|
+
props,
|
|
74
|
+
/* .children = */ ShadowNodeFragment::childrenPlaceholder(),
|
|
75
|
+
/* .state = */ state,
|
|
76
|
+
},
|
|
77
|
+
family);
|
|
78
|
+
|
|
79
|
+
for (const auto &child : sn->getChildren()) {
|
|
80
|
+
auto const clonedChild = copyShadowSubtree(child);
|
|
81
|
+
cd.appendChild(shadowNode, clonedChild);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return shadowNode;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void ShadowNodeCopyMachine::clearParent(
|
|
88
|
+
const std::shared_ptr<const ShadowNode> &sn) {
|
|
89
|
+
auto *family =
|
|
90
|
+
reinterpret_cast<const ShadowNodeFamilyHack *>(&sn->getFamily());
|
|
91
|
+
family->hasParent_ = false;
|
|
92
|
+
family->parent_.reset();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <jsi/jsi.h>
|
|
4
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
5
|
+
#include <react/renderer/components/wishlist/Props.h>
|
|
6
|
+
#include <react/renderer/core/InstanceHandle.h>
|
|
7
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
8
|
+
#include <react/renderer/core/LayoutContext.h>
|
|
9
|
+
#include <react/renderer/core/ShadowNodeFamily.h>
|
|
10
|
+
#include <stdio.h>
|
|
11
|
+
#include <iostream>
|
|
12
|
+
|
|
13
|
+
using namespace facebook;
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
|
|
16
|
+
namespace Wishlist {
|
|
17
|
+
|
|
18
|
+
class ShadowNodeCopyMachine {
|
|
19
|
+
public:
|
|
20
|
+
static std::shared_ptr<ShadowNode> copyShadowSubtree(
|
|
21
|
+
const std::shared_ptr<const ShadowNode> &sn);
|
|
22
|
+
static void clearParent(const std::shared_ptr<const ShadowNode> &sn);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MGVSyncRequester.hpp
|
|
3
|
+
// MGWishList
|
|
4
|
+
//
|
|
5
|
+
// Created by Szymon on 13/01/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <stdio.h>
|
|
11
|
+
|
|
12
|
+
namespace Wishlist {
|
|
13
|
+
|
|
14
|
+
struct MGVSyncRequester {
|
|
15
|
+
virtual void requestVSync() = 0;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
}; // namespace Wishlist
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MGViewportCarer.hpp
|
|
3
|
+
// MGWishList
|
|
4
|
+
//
|
|
5
|
+
// Created by Szymon on 13/01/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <react/renderer/uimanager/UIManager.h>
|
|
11
|
+
#include <stdio.h>
|
|
12
|
+
|
|
13
|
+
namespace Wishlist {
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
|
|
17
|
+
static float MG_NO_OFFSET = std::numeric_limits<float>::min();
|
|
18
|
+
|
|
19
|
+
struct MGDims {
|
|
20
|
+
float width;
|
|
21
|
+
float height;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class MGViewportCarer {
|
|
25
|
+
public:
|
|
26
|
+
virtual void initialRenderAsync(
|
|
27
|
+
MGDims dimensions,
|
|
28
|
+
float initialContentSize,
|
|
29
|
+
int originItem,
|
|
30
|
+
const std::vector<std::shared_ptr<ShadowNode const>> ®isteredViews,
|
|
31
|
+
const std::vector<std::string> &names,
|
|
32
|
+
const std::string &inflatorId) = 0;
|
|
33
|
+
|
|
34
|
+
virtual void didScrollAsync(
|
|
35
|
+
MGDims dimensions,
|
|
36
|
+
float contentOffset,
|
|
37
|
+
const std::string &inflatorId) = 0;
|
|
38
|
+
|
|
39
|
+
virtual void didUpdateContentOffset() = 0;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
}; // namespace Wishlist
|