diff --git a/ReactCommon/fabric/components/image/ImageShadowNode.h b/ReactCommon/fabric/components/image/ImageShadowNode.h index d4cf8d5cb5a..a723a000b19 100644 --- a/ReactCommon/fabric/components/image/ImageShadowNode.h +++ b/ReactCommon/fabric/components/image/ImageShadowNode.h @@ -43,7 +43,7 @@ class ImageShadowNode final : public ConcreteViewShadowNode< static ImageState initialStateData( ShadowNodeFragment const &fragment, - SurfaceId const surfaceId, + ShadowNodeFamilyFragment const &familyFragment, ComponentDescriptor const &componentDescriptor) { auto imageSource = ImageSource{ImageSource::Type::Invalid}; return {imageSource, {imageSource, nullptr}}; diff --git a/ReactCommon/fabric/components/slider/SliderShadowNode.h b/ReactCommon/fabric/components/slider/SliderShadowNode.h index f4b9c334fad..958f3b2aafb 100644 --- a/ReactCommon/fabric/components/slider/SliderShadowNode.h +++ b/ReactCommon/fabric/components/slider/SliderShadowNode.h @@ -40,7 +40,7 @@ class SliderShadowNode final : public ConcreteViewShadowNode< static SliderState initialStateData( ShadowNodeFragment const &fragment, - SurfaceId const surfaceId, + ShadowNodeFamilyFragment const &familyFragment, ComponentDescriptor const &componentDescriptor) { auto imageSource = ImageSource{ImageSource::Type::Invalid}; return {imageSource, diff --git a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h b/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h index 7b7550447e6..43fbeaf40cf 100644 --- a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h +++ b/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h @@ -133,7 +133,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { return std::make_shared( std::make_shared( ConcreteShadowNode::initialStateData( - fragment, family->getSurfaceId(), *this)), + fragment, ShadowNodeFamilyFragment::build(*family), *this)), family); } diff --git a/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h b/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h index fded3fe4bd1..7edb2e56783 100644 --- a/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h +++ b/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h @@ -82,7 +82,7 @@ class ConcreteShadowNode : public BaseShadowNodeT { static ConcreteStateData initialStateData( ShadowNodeFragment const &fragment, - SurfaceId const surfaceId, + ShadowNodeFamilyFragment const &familyFragment, ComponentDescriptor const &componentDescriptor) { return {}; } diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h b/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h index ea9699ce35d..15998067f44 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h +++ b/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h @@ -87,6 +87,7 @@ class ShadowNodeFamily { private: friend ShadowNode; + friend ShadowNodeFamilyFragment; EventDispatcher::Weak eventDispatcher_; mutable std::shared_ptr mostRecentState_; diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.cpp b/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.cpp new file mode 100644 index 00000000000..150ef2760d3 --- /dev/null +++ b/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "ShadowNodeFamilyFragment.h" + +#include + +namespace facebook { +namespace react { + +ShadowNodeFamilyFragment ShadowNodeFamilyFragment::build( + ShadowNodeFamily const &family) { + return { + family.tag_, + family.surfaceId_, + family.eventEmitter_, + }; +} + +} // namespace react +} // namespace facebook diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h b/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h index 88de3a07d2b..11359418c72 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h +++ b/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h @@ -13,6 +13,8 @@ namespace facebook { namespace react { +class ShadowNodeFamily; + /* * Note: All of the fields are `const &` references (essentially just raw * pointers) which means that the Fragment does not copy/store them nor @@ -20,6 +22,8 @@ namespace react { */ class ShadowNodeFamilyFragment final { public: + static ShadowNodeFamilyFragment build(ShadowNodeFamily const &family); + Tag const tag; SurfaceId const surfaceId; EventEmitter::Shared const &eventEmitter;