Fabric: YogaStylableProps now inherits Props

Summary:
How we can finally make `ViewProps` inherit `YogaStylableProps` and remove `dynamic_cast`. This overall change is aligned with D19963353.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20052026

fbshipit-source-id: 1066f9a259b50d4672111c9c03a71c2590d59aca
This commit is contained in:
Valentin Shergin 2020-02-26 22:03:14 -08:00 коммит произвёл Facebook Github Bot
Родитель 6d10310733
Коммит 33bf310920
5 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -19,8 +19,7 @@ namespace facebook {
namespace react {
ViewProps::ViewProps(ViewProps const &sourceProps, RawProps const &rawProps)
: Props(sourceProps, rawProps),
YogaStylableProps(sourceProps, rawProps),
: YogaStylableProps(sourceProps, rawProps),
AccessibilityProps(sourceProps, rawProps),
opacity(
convertRawProp(rawProps, "opacity", sourceProps.opacity, (Float)1.0)),

Просмотреть файл

@ -23,9 +23,7 @@ class ViewProps;
using SharedViewProps = std::shared_ptr<ViewProps const>;
class ViewProps : public Props,
public YogaStylableProps,
public AccessibilityProps {
class ViewProps : public YogaStylableProps, public AccessibilityProps {
public:
ViewProps() = default;
ViewProps(ViewProps const &sourceProps, RawProps const &rawProps);

Просмотреть файл

@ -36,7 +36,7 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode(
yogaNode_(&initializeYogaConfig(yogaConfig_)) {
yogaNode_.setContext(this);
setProps(dynamic_cast<YogaStylableProps const &>(*fragment.props));
setProps(static_cast<YogaStylableProps const &>(*fragment.props));
setChildren(YogaLayoutableShadowNode::getYogaLayoutableChildren());
}

Просмотреть файл

@ -22,7 +22,8 @@ namespace react {
YogaStylableProps::YogaStylableProps(
YogaStylableProps const &sourceProps,
RawProps const &rawProps)
: yogaStyle(convertRawProp(rawProps, sourceProps.yogaStyle)){};
: Props(sourceProps, rawProps),
yogaStyle(convertRawProp(rawProps, sourceProps.yogaStyle)){};
#pragma mark - DebugStringConvertible

Просмотреть файл

@ -15,7 +15,7 @@
namespace facebook {
namespace react {
class YogaStylableProps {
class YogaStylableProps : public Props {
public:
YogaStylableProps() = default;
YogaStylableProps(