mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a75bbe7552
Summary: Copy-paste error Changelog: [Internal] Reviewed By: genkikondo Differential Revision: D34077530 fbshipit-source-id: 04ab17ba9308762361d993b7ed1b372af400b8d1
48 lines
1.3 KiB
C++
48 lines
1.3 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 {
|
|
namespace react {
|
|
|
|
/*
|
|
* Descriptor for <ModalHostView> component.
|
|
*/
|
|
|
|
class ModalHostViewComponentDescriptor final
|
|
: public ConcreteComponentDescriptor<ModalHostViewShadowNode> {
|
|
public:
|
|
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
|
|
|
|
void adopt(ShadowNode::Unshared const &shadowNode) const override {
|
|
auto modalShadowNode =
|
|
std::static_pointer_cast<ModalHostViewShadowNode>(shadowNode);
|
|
|
|
auto layoutableShadowNode =
|
|
std::static_pointer_cast<YogaLayoutableShadowNode>(modalShadowNode);
|
|
|
|
auto state =
|
|
std::static_pointer_cast<const ModalHostViewShadowNode::ConcreteState>(
|
|
shadowNode->getState());
|
|
auto stateData = state->getData();
|
|
|
|
layoutableShadowNode->setSize(
|
|
Size{stateData.screenSize.width, stateData.screenSize.height});
|
|
layoutableShadowNode->setPositionType(YGPositionTypeAbsolute);
|
|
|
|
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
}
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|