mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
c0e7e1bd9c
Summary: Original commit changeset: 6fd54661305a Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D22532594 fbshipit-source-id: 5ca25328cfe11416a9721a90611eff56e14cb49f
68 lines
1.7 KiB
C++
68 lines
1.7 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/components/view/ConcreteViewShadowNode.h>
|
|
#include <react/components/view/ViewEventEmitter.h>
|
|
#include <react/components/view/ViewProps.h>
|
|
#include <react/core/ConcreteComponentDescriptor.h>
|
|
#include <react/core/RawProps.h>
|
|
#include <react/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:
|
|
using ViewProps::ViewProps;
|
|
|
|
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;
|
|
}
|
|
};
|
|
|
|
class TestComponentDescriptor
|
|
: public ConcreteComponentDescriptor<TestShadowNode> {
|
|
public:
|
|
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
|
|
};
|