Fabric: Sharing a pointer to ShadowTreeRegister with UIManager

Summary: The diff adds a pointer to ShadowTreeRegistry to UIManager which enables the possibility of implementing ShadowTree mutating and inspecting methods like `setNativeProps` and `getRelativeLayoutMetrics`.

Reviewed By: mdvacca

Differential Revision: D13036549

fbshipit-source-id: 5ed1252d84c8dd895fe0e6e8cc71afbaa9dab4b7
This commit is contained in:
Valentin Shergin
2018-11-21 17:10:31 -08:00
committed by Facebook Github Bot
parent b4fa1fa0c6
commit f8be867cd8
4 changed files with 10 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ Scheduler::Scheduler(const SharedContextContainer &contextContainer)
eventDispatcher, contextContainer);
uiManagerRef.setDelegate(this);
uiManagerRef.setShadowTreeRegistry(&shadowTreeRegistry_);
uiManagerRef.setComponentDescriptorRegistry(componentDescriptorRegistry_);
runtimeExecutor_([=](jsi::Runtime &runtime) {

View File

@@ -67,6 +67,10 @@ void UIManager::completeSurface(
}
}
void UIManager::setShadowTreeRegistry(ShadowTreeRegistry *shadowTreeRegistry) {
shadowTreeRegistry_ = shadowTreeRegistry;
}
void UIManager::setComponentDescriptorRegistry(
const SharedComponentDescriptorRegistry &componentDescriptorRegistry) {
componentDescriptorRegistry_ = componentDescriptorRegistry;

View File

@@ -8,6 +8,7 @@
#include <react/core/ShadowNode.h>
#include <react/uimanager/ComponentDescriptorRegistry.h>
#include <react/uimanager/ShadowTreeRegistry.h>
#include <react/uimanager/UIManagerDelegate.h>
namespace facebook {
@@ -15,6 +16,8 @@ namespace react {
class UIManager {
public:
void setShadowTreeRegistry(ShadowTreeRegistry *shadowTreeRegistry);
void setComponentDescriptorRegistry(
const SharedComponentDescriptorRegistry &componentDescriptorRegistry);
@@ -49,6 +52,7 @@ class UIManager {
SurfaceId surfaceId,
const SharedShadowNodeUnsharedList &rootChildren) const;
ShadowTreeRegistry *shadowTreeRegistry_;
SharedComponentDescriptorRegistry componentDescriptorRegistry_;
UIManagerDelegate *delegate_;
};

View File

@@ -90,6 +90,7 @@ void UIManagerBinding::dispatchEvent(
}
void UIManagerBinding::invalidate() const {
uiManager_->setShadowTreeRegistry(nullptr);
uiManager_->setDelegate(nullptr);
}