-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathEnrichedTextInputShadowNode.h
More file actions
53 lines (43 loc) · 1.82 KB
/
Copy pathEnrichedTextInputShadowNode.h
File metadata and controls
53 lines (43 loc) · 1.82 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
#pragma once
#include "EnrichedTextInputMeasurementManager.h"
#include "EnrichedTextInputState.h"
#include <react/renderer/components/ReactNativeEnrichedSpec/EventEmitters.h>
#include <react/renderer/components/ReactNativeEnrichedSpec/Props.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
namespace facebook::react {
JSI_EXPORT extern const char EnrichedTextInputComponentName[];
/*
* `ShadowNode` for <EnrichedTextInputView> component.
*/
class EnrichedTextInputShadowNode final
: public ConcreteViewShadowNode<
EnrichedTextInputComponentName, EnrichedTextInputViewProps,
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_{0};
std::shared_ptr<EnrichedTextInputMeasurementManager> measurementsManager_;
};
} // namespace facebook::react