-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathEnrichedTextInputShadowNode.h
More file actions
54 lines (44 loc) · 1.84 KB
/
Copy pathEnrichedTextInputShadowNode.h
File metadata and controls
54 lines (44 loc) · 1.84 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
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "EnrichedTextInputMeasurementManager.h"
#include "EnrichedTextInputState.h"
#include "EnrichedTextInputProps.h"
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h>
namespace facebook::react {
JSI_EXPORT extern const char EnrichedTextInputComponentName[];
/*
* `ShadowNode` for <EnrichedTextInputView> component.
*/
class EnrichedTextInputShadowNode final : public ConcreteViewShadowNode<
EnrichedTextInputComponentName,
EnrichedTextInputProps,
EnrichedTextInputViewEventEmitter,
EnrichedTextInputState> {
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;
// This constructor is called when we "update" shadow node, e.g. after updating shadow node's state
EnrichedTextInputShadowNode(
ShadowNode const &sourceShadowNode,
ShadowNodeFragment const &fragment)
: ConcreteViewShadowNode(sourceShadowNode, fragment) {
dirtyLayoutIfNeeded();
}
static ShadowNodeTraits BaseTraits() {
auto traits = ConcreteViewShadowNode::BaseTraits();
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
return traits;
}
// Associates a shared `EnrichedTextInputMeasurementManager` with the node.
void setMeasurementsManager(
const std::shared_ptr<EnrichedTextInputMeasurementManager>&
measurementsManager);
void dirtyLayoutIfNeeded();
Size measureContent(
const LayoutContext& layoutContext,
const LayoutConstraints& layoutConstraints) const override;
private:
int forceHeightRecalculationCounter_;
std::shared_ptr<EnrichedTextInputMeasurementManager> measurementsManager_;
};
} // namespace facebook::react