Files
react-native/ReactCommon/react/renderer/core/tests/TestComponent.h
T
empyrical 777bf6529a Fabric Tests: Change default constructor in TestComponents' TestProps (#29898)
Summary:
This pull request changes the default constructor in the `TestProps` class in `react/renderer/core/tests/TestComponent.h`

`using ViewProps::ViewProps;` was causing problems in Visual Studio 2017 - changing it to ` TestProps() = default;` allowed dependent CPP files to compile on MSVC and caused no regressions in the Fabric test suite.

## Changelog

Changelog: [Internal] [Changed] - Fabric Tests: Change default constructor in TestComponents' TestProps

Pull Request resolved: https://github.com/facebook/react-native/pull/29898

Test Plan: The Fabric test suite passes on Windows after this change is made. I also tested it under macOS and Linux built with Clang and they both pass with this change made.

Reviewed By: sammy-SC

Differential Revision: D23591986

Pulled By: shergin

fbshipit-source-id: 132e1c2e38fa74aa4f2c8746054d6152f30035e9
2020-09-10 10:41:27 -07:00

74 lines
1.9 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.
*/
#pragma once
#include <memory>
#include <folly/dynamic.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/components/view/ViewEventEmitter.h>
#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/core/RawProps.h>
#include <react/renderer/core/ShadowNode.h>
using namespace facebook::react;
/**
* This defines a set of TestComponent classes: Props, ShadowNode,
* ComponentDescriptor. To be used for testing purpose.
*/
class TestState {
public:
int number;
};
static const char TestComponentName[] = "Test";
class TestProps : public ViewProps {
public:
TestProps() = default;
TestProps(const TestProps &sourceProps, const RawProps &rawProps)
: ViewProps(sourceProps, rawProps) {}
};
using SharedTestProps = std::shared_ptr<const TestProps>;
class TestShadowNode;
using SharedTestShadowNode = std::shared_ptr<const TestShadowNode>;
class TestShadowNode : public ConcreteViewShadowNode<
TestComponentName,
TestProps,
ViewEventEmitter,
TestState> {
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;
Transform _transform{Transform::Identity()};
Transform getTransform() const override {
return _transform;
}
facebook::react::Point _contentOriginOffset{};
facebook::react::Point getContentOriginOffset() const override {
return _contentOriginOffset;
}
};
class TestComponentDescriptor
: public ConcreteComponentDescriptor<TestShadowNode> {
public:
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
};