Files
react-native/ReactCommon/fabric/components/root/RootProps.cpp
T
Valentin Shergin 6d10310733 Fabric: Removing a couple of (ViewProps and YogaStylableProps) constructors
Summary:
Here we delete several constructors that were needed only because `YogaLayoutableShadowNode::yogaStyle` was private (which is not true anymore).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC, mdvacca

Differential Revision: D20052033

fbshipit-source-id: c2afcaf2fdebb65cdcde6c214c8b78aa35d45e91
2020-02-26 22:08:20 -08:00

50 lines
1.5 KiB
C++

/*
* 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 "RootProps.h"
#include <react/components/view/YogaLayoutableShadowNode.h>
#include <react/components/view/conversions.h>
namespace facebook {
namespace react {
static YGStyle yogaStyleFromLayoutConstraints(
LayoutConstraints const &layoutConstraints) {
auto yogaStyle = YGStyle{};
yogaStyle.minDimensions()[YGDimensionWidth] =
yogaStyleValueFromFloat(layoutConstraints.minimumSize.width);
yogaStyle.minDimensions()[YGDimensionHeight] =
yogaStyleValueFromFloat(layoutConstraints.minimumSize.height);
yogaStyle.maxDimensions()[YGDimensionWidth] =
yogaStyleValueFromFloat(layoutConstraints.maximumSize.width);
yogaStyle.maxDimensions()[YGDimensionHeight] =
yogaStyleValueFromFloat(layoutConstraints.maximumSize.height);
yogaStyle.direction() =
yogaDirectionFromLayoutDirection(layoutConstraints.layoutDirection);
return yogaStyle;
}
RootProps::RootProps(RootProps const &sourceProps, RawProps const &rawProps)
: ViewProps(sourceProps, rawProps) {}
RootProps::RootProps(
RootProps const &sourceProps,
LayoutConstraints const &layoutConstraints,
LayoutContext const &layoutContext)
: ViewProps(),
layoutConstraints(layoutConstraints),
layoutContext(layoutContext) {
yogaStyle = yogaStyleFromLayoutConstraints(layoutConstraints);
};
} // namespace react
} // namespace facebook