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
This commit is contained in:
Valentin Shergin
2019-05-06 17:01:14 -07:00
committed by Facebook Github Bot
parent e94b116d76
commit 0e35406e4e
3 changed files with 17 additions and 0 deletions

View File

@@ -117,6 +117,10 @@ class ConcreteViewShadowNode : public ConcreteShadowNode<
return clonedChildShadowNode.get(); return clonedChildShadowNode.get();
} }
Transform getTransform() const override {
return BaseShadowNode::getProps()->transform;
}
#pragma mark - DebugStringConvertible #pragma mark - DebugStringConvertible
#if RN_DEBUG_STRING_CONVERTIBLE #if RN_DEBUG_STRING_CONVERTIBLE

View File

@@ -36,6 +36,10 @@ bool LayoutableShadowNode::LayoutableShadowNode::isLayoutOnly() const {
return false; return false;
} }
Transform LayoutableShadowNode::getTransform() const {
return Transform::Identity();
}
LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics( LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics(
const LayoutableShadowNode &ancestorLayoutableShadowNode) const { const LayoutableShadowNode &ancestorLayoutableShadowNode) const {
auto &ancestorShadowNode = auto &ancestorShadowNode =

View File

@@ -17,6 +17,7 @@
#include <react/core/Sealable.h> #include <react/core/Sealable.h>
#include <react/core/ShadowNode.h> #include <react/core/ShadowNode.h>
#include <react/debug/DebugStringConvertible.h> #include <react/debug/DebugStringConvertible.h>
#include <react/graphics/Transform.h>
namespace facebook { namespace facebook {
namespace react { namespace react {
@@ -64,6 +65,14 @@ class LayoutableShadowNode : public virtual Sealable {
*/ */
virtual bool isLayoutOnly() const; 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. * Returns layout metrics relatively to the given ancestor node.
*/ */