From 0e35406e4ead71b26cee152bd6f68d0e500decef Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 6 May 2019 17:01:14 -0700 Subject: [PATCH] Fabric: LayoutableShadowNode::getTransform Summary: `LayoutableShadowNode::getTransform` returns a transform object that represents transformations that will/should be applied on top of regular layout metrics by mounting layer. Reviewed By: mdvacca Differential Revision: D15219262 fbshipit-source-id: e7aeb85b5f7e2fce3f8faf9dfcaee5dae3217d36 --- .../fabric/components/view/ConcreteViewShadowNode.h | 4 ++++ ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp | 4 ++++ ReactCommon/fabric/core/layout/LayoutableShadowNode.h | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h b/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h index f1be7bbff..09d45069a 100644 --- a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h +++ b/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h @@ -117,6 +117,10 @@ class ConcreteViewShadowNode : public ConcreteShadowNode< return clonedChildShadowNode.get(); } + Transform getTransform() const override { + return BaseShadowNode::getProps()->transform; + } + #pragma mark - DebugStringConvertible #if RN_DEBUG_STRING_CONVERTIBLE diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp index 5ebcf8c0e..26f7633d5 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp @@ -36,6 +36,10 @@ bool LayoutableShadowNode::LayoutableShadowNode::isLayoutOnly() const { return false; } +Transform LayoutableShadowNode::getTransform() const { + return Transform::Identity(); +} + LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics( const LayoutableShadowNode &ancestorLayoutableShadowNode) const { auto &ancestorShadowNode = diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h index 569bc677d..d28561cce 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace facebook { namespace react { @@ -64,6 +65,14 @@ class LayoutableShadowNode : public virtual Sealable { */ virtual bool isLayoutOnly() const; + /* + * Returns a transform object that represents transformations that will/should + * be applied on top of regular layout metrics by mounting layer. + * The `transform` value modifies a coordinate space of a layout system. + * Default implementation returns `Identity` transform. + */ + virtual Transform getTransform() const; + /* * Returns layout metrics relatively to the given ancestor node. */