-
-
Notifications
You must be signed in to change notification settings - Fork 643
Expand file tree
/
Copy pathRNSFormSheetHostComponentDescriptor.h
More file actions
41 lines (29 loc) · 1.21 KB
/
RNSFormSheetHostComponentDescriptor.h
File metadata and controls
41 lines (29 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#if !defined(ANDROID)
#include <react/debug/react_native_assert.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include "RNSFormSheetHostShadowNode.h"
namespace facebook::react {
class RNSFormSheetHostComponentDescriptor final
: public ConcreteComponentDescriptor<RNSFormSheetHostShadowNode> {
public:
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
void adopt(ShadowNode &shadowNode) const override {
react_native_assert(
dynamic_cast<RNSFormSheetHostShadowNode *>(&shadowNode));
auto &concreteShadowNode =
static_cast<RNSFormSheetHostShadowNode &>(shadowNode);
react_native_assert(
dynamic_cast<YogaLayoutableShadowNode *>(&concreteShadowNode));
auto &layoutableShadowNode =
static_cast<YogaLayoutableShadowNode &>(concreteShadowNode);
auto state = std::static_pointer_cast<
const RNSFormSheetHostShadowNode::ConcreteState>(shadowNode.getState());
auto stateData = state->getData();
layoutableShadowNode.setSize(
Size{stateData.frameSize.width, stateData.frameSize.height});
ConcreteComponentDescriptor::adopt(shadowNode);
}
};
} // namespace facebook::react
#endif // !defined(ANDROID)