newsmemory-ios-sdk/Frameworks/React-FabricComponents.xcfr.../ios-arm64_x86_64-simulator/Headers/react/renderer/components/modal/ModalHostViewComponentDescr...

42 lines
1.2 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and 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 <glog/logging.h>
#include <react/renderer/components/modal/ModalHostViewShadowNode.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
namespace facebook::react {
/*
* Descriptor for <ModalHostView> component.
*/
class ModalHostViewComponentDescriptor final
: public ConcreteComponentDescriptor<ModalHostViewShadowNode> {
public:
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
void adopt(ShadowNode& shadowNode) const override {
auto& layoutableShadowNode =
static_cast<YogaLayoutableShadowNode&>(shadowNode);
auto& stateData =
static_cast<const ModalHostViewShadowNode::ConcreteState&>(
*shadowNode.getState())
.getData();
layoutableShadowNode.setSize(
Size{stateData.screenSize.width, stateData.screenSize.height});
layoutableShadowNode.setPositionType(YGPositionTypeAbsolute);
ConcreteComponentDescriptor::adopt(shadowNode);
}
};
} // namespace facebook::react