diff --git a/React/Fabric/Utils/MainRunLoopEventBeat.h b/React/Fabric/Utils/MainRunLoopEventBeat.h index b0e029eb6a0..189e062f645 100644 --- a/React/Fabric/Utils/MainRunLoopEventBeat.h +++ b/React/Fabric/Utils/MainRunLoopEventBeat.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include namespace facebook { diff --git a/React/Fabric/Utils/RuntimeEventBeat.h b/React/Fabric/Utils/RuntimeEventBeat.h index 1ddd3983c28..09fba65f5e0 100644 --- a/React/Fabric/Utils/RuntimeEventBeat.h +++ b/React/Fabric/Utils/RuntimeEventBeat.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp b/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp index c8c2851d2e8..680c0afd3a1 100644 --- a/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp +++ b/ReactCommon/fabric/uimanager/ComponentDescriptorRegistry.cpp @@ -6,6 +6,7 @@ #include "ComponentDescriptorRegistry.h" #include +#include namespace facebook { namespace react { @@ -80,25 +81,6 @@ static const std::string componentNameByReactViewName(std::string viewName) { return viewName; } -static const RawProps rawPropsFromDynamic(const folly::dynamic object) { - // TODO: Convert this to something smarter, probably returning - // `std::iterator`. - RawProps result; - - if (object.isNull()) { - return result; - } - - assert(object.isObject()); - - for (const auto &pair : object.items()) { - assert(pair.first.isString()); - result[pair.first.asString()] = pair.second; - } - - return result; -} - SharedShadowNode ComponentDescriptorRegistry::createNode( Tag tag, const std::string &viewName, diff --git a/ReactCommon/fabric/uimanager/JSIFabricUIManager.cpp b/ReactCommon/fabric/uimanager/JSIFabricUIManager.cpp index 75149873664..dabfecb4542 100644 --- a/ReactCommon/fabric/uimanager/JSIFabricUIManager.cpp +++ b/ReactCommon/fabric/uimanager/JSIFabricUIManager.cpp @@ -2,6 +2,8 @@ #include "JSIFabricUIManager.h" +#include +#include #include #include #include @@ -11,39 +13,7 @@ namespace react { namespace { -struct EventTargetWrapper : public EventTarget { - EventTargetWrapper(jsi::WeakObject instanceHandle) - : instanceHandle(std::move(instanceHandle)) {} - - mutable jsi::WeakObject instanceHandle; -}; - -struct EventHandlerWrapper : public EventHandler { - EventHandlerWrapper(jsi::Function eventHandler) - : callback(std::move(eventHandler)) {} - - jsi::Function callback; -}; - -struct ShadowNodeWrapper : public jsi::HostObject { - ShadowNodeWrapper(SharedShadowNode shadowNode) - : shadowNode(std::move(shadowNode)) {} - - SharedShadowNode shadowNode; -}; - -struct ShadowNodeListWrapper : public jsi::HostObject { - ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList) - : shadowNodeList(shadowNodeList) {} - - SharedShadowNodeUnsharedList shadowNodeList; -}; - -jsi::Value createNode( - const UIManager &uiManager, - jsi::Runtime &runtime, - const jsi::Value *arguments, - size_t count) { +jsi::Value createNode(const UIManager &uiManager, jsi::Runtime &runtime, const jsi::Value *arguments, size_t count) { auto reactTag = (Tag)arguments[0].getNumber(); auto viewName = arguments[1].getString(runtime).utf8(runtime); auto rootTag = (Tag)arguments[2].getNumber(); diff --git a/ReactCommon/fabric/uimanager/Scheduler.h b/ReactCommon/fabric/uimanager/Scheduler.h index 4961dad728f..fcc5e5b3b77 100644 --- a/ReactCommon/fabric/uimanager/Scheduler.h +++ b/ReactCommon/fabric/uimanager/Scheduler.h @@ -16,6 +16,7 @@ #include #include #include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/uimanager/primitives.h b/ReactCommon/fabric/uimanager/primitives.h new file mode 100644 index 00000000000..7f7c4b8e119 --- /dev/null +++ b/ReactCommon/fabric/uimanager/primitives.h @@ -0,0 +1,62 @@ +// Copyright 2004-present Facebook. All Rights Reserved. + +#pragma once + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +using RuntimeExecutor = std::function &&callback)>; + +inline RawProps rawPropsFromDynamic(const folly::dynamic object) noexcept { + RawProps result; + + if (object.isNull()) { + return result; + } + + assert(object.isObject()); + + for (const auto &pair : object.items()) { + assert(pair.first.isString()); + result[pair.first.asString()] = pair.second; + } + + return result; +} + +struct EventTargetWrapper : public EventTarget { + EventTargetWrapper(jsi::WeakObject instanceHandle) + : instanceHandle(std::move(instanceHandle)) {} + + mutable jsi::WeakObject instanceHandle; +}; + +struct EventHandlerWrapper : public EventHandler { + EventHandlerWrapper(jsi::Function eventHandler) + : callback(std::move(eventHandler)) {} + + jsi::Function callback; +}; + +struct ShadowNodeWrapper : public jsi::HostObject { + ShadowNodeWrapper(SharedShadowNode shadowNode) + : shadowNode(std::move(shadowNode)) {} + + SharedShadowNode shadowNode; +}; + +struct ShadowNodeListWrapper : public jsi::HostObject { + ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList) + : shadowNodeList(shadowNodeList) {} + + SharedShadowNodeUnsharedList shadowNodeList; +}; + +} // namespace react +} // namespace facebook