mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Make RootProps constructible from RawProps
Summary: Even though it makes no sense to construct RootProps from RawProps, we need to support that (even if it's no-op) to be able to call this once from generic `ConcreteComponentDescriptor`. We will need it in the coming diff. Reviewed By: mdvacca Differential Revision: D15752970 fbshipit-source-id: b75a4023c5d0425a8dbe0f104a36a0f265eb6084
This commit is contained in:
committed by
Facebook Github Bot
parent
4a4fabf835
commit
4d35e4d92c
@@ -14,7 +14,7 @@ namespace facebook {
|
||||
namespace react {
|
||||
|
||||
static YGStyle yogaStyleFromLayoutConstraints(
|
||||
const LayoutConstraints &layoutConstraints) {
|
||||
LayoutConstraints const &layoutConstraints) {
|
||||
auto yogaStyle = YGStyle{};
|
||||
yogaStyle.minDimensions()[YGDimensionWidth] =
|
||||
yogaStyleValueFromFloat(layoutConstraints.minimumSize.width);
|
||||
@@ -32,15 +32,13 @@ static YGStyle yogaStyleFromLayoutConstraints(
|
||||
return yogaStyle;
|
||||
}
|
||||
|
||||
RootProps::RootProps(const RootProps &sourceProps, const RawProps &rawProps) {
|
||||
// `RootProps` cannot be constructed from `RawProps`.
|
||||
assert(false);
|
||||
}
|
||||
RootProps::RootProps(RootProps const &sourceProps, RawProps const &rawProps)
|
||||
: ViewProps(sourceProps, rawProps) {}
|
||||
|
||||
RootProps::RootProps(
|
||||
const RootProps &sourceProps,
|
||||
const LayoutConstraints &layoutConstraints,
|
||||
const LayoutContext &layoutContext)
|
||||
RootProps const &sourceProps,
|
||||
LayoutConstraints const &layoutConstraints,
|
||||
LayoutContext const &layoutContext)
|
||||
: ViewProps(yogaStyleFromLayoutConstraints(layoutConstraints)),
|
||||
layoutConstraints(layoutConstraints),
|
||||
layoutContext(layoutContext){};
|
||||
|
||||
@@ -16,23 +16,19 @@
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class RootProps;
|
||||
|
||||
using SharedRootProps = std::shared_ptr<const RootProps>;
|
||||
|
||||
class RootProps final : public ViewProps {
|
||||
public:
|
||||
RootProps() = default;
|
||||
RootProps(const RootProps &sourceProps, const RawProps &rawProps);
|
||||
RootProps(RootProps const &sourceProps, RawProps const &rawProps);
|
||||
RootProps(
|
||||
const RootProps &sourceProps,
|
||||
const LayoutConstraints &layoutConstraints,
|
||||
const LayoutContext &layoutContext);
|
||||
RootProps const &sourceProps,
|
||||
LayoutConstraints const &layoutConstraints,
|
||||
LayoutContext const &layoutContext);
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
const LayoutConstraints layoutConstraints{};
|
||||
const LayoutContext layoutContext{};
|
||||
LayoutConstraints const layoutConstraints{};
|
||||
LayoutContext const layoutContext{};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user