mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Element, Shape, Group, Text are too generic, we are renaming these classes to ARTElement, ARTBGroup, ARTShape... changelog: [Internal] internal changes to support ART in android Reviewed By: JoshuaGross Differential Revision: D21681878 fbshipit-source-id: f6b35443486a3db210f61dcaf91bd32df47fbc66
63 lines
1.7 KiB
C++
63 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 <react/components/art/ARTElement.h>
|
|
#include <react/components/art/ARTSurfaceViewProps.h>
|
|
#include <react/components/art/ARTSurfaceViewState.h>
|
|
#include <react/components/view/ConcreteViewShadowNode.h>
|
|
#include <react/core/ConcreteShadowNode.h>
|
|
#include <react/core/LayoutContext.h>
|
|
#include <react/core/ShadowNode.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
extern const char ARTSurfaceViewComponentName[];
|
|
|
|
using ARTSurfaceViewEventEmitter = ViewEventEmitter;
|
|
|
|
/*
|
|
* `ShadowNode` for <ARTSurfaceViewState> component, represents <View>-like
|
|
* component containing that will be used to display ARTElements.
|
|
*/
|
|
class ARTSurfaceViewShadowNode : public ConcreteViewShadowNode<
|
|
ARTSurfaceViewComponentName,
|
|
ARTSurfaceViewProps,
|
|
ARTSurfaceViewEventEmitter,
|
|
ARTSurfaceViewState> {
|
|
public:
|
|
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
|
|
static ShadowNodeTraits BaseTraits() {
|
|
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
|
|
return traits;
|
|
}
|
|
|
|
class Content final {
|
|
public:
|
|
ARTElement::ListOfShared elements{};
|
|
};
|
|
|
|
void layout(LayoutContext layoutContext) override;
|
|
|
|
private:
|
|
Content const &getContent() const;
|
|
|
|
void updateStateIfNeeded(Content const &content);
|
|
|
|
/*
|
|
* Cached content of the subtree started from the node.
|
|
*/
|
|
mutable better::optional<Content> content_{};
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|