-
-
Notifications
You must be signed in to change notification settings - Fork 643
Expand file tree
/
Copy pathRNSFormSheetComponentDescriptor.h
More file actions
43 lines (31 loc) · 1.26 KB
/
RNSFormSheetComponentDescriptor.h
File metadata and controls
43 lines (31 loc) · 1.26 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
42
43
#pragma once
#ifndef ANDROID
#include <react/debug/react_native_assert.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include "RNSFormSheetShadowNode.h"
namespace facebook::react {
class RNSFormSheetComponentDescriptor final
: public ConcreteComponentDescriptor<RNSFormSheetShadowNode> {
public:
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
void adopt(ShadowNode &shadowNode) const override {
react_native_assert(dynamic_cast<RNSFormSheetShadowNode *>(&shadowNode));
auto &concreteShadowNode =
static_cast<RNSFormSheetShadowNode &>(shadowNode);
react_native_assert(
dynamic_cast<YogaLayoutableShadowNode *>(&concreteShadowNode));
auto &layoutableShadowNode =
static_cast<YogaLayoutableShadowNode &>(concreteShadowNode);
auto state =
std::static_pointer_cast<const RNSFormSheetShadowNode::ConcreteState>(
shadowNode.getState());
auto stateData = state->getData();
if (stateData.frameSize.width >= 0 && stateData.frameSize.height >= 0) {
layoutableShadowNode.setSize(
Size{stateData.frameSize.width, stateData.frameSize.height});
}
ConcreteComponentDescriptor::adopt(shadowNode);
}
};
} // namespace facebook::react
#endif // ANDROID