#pragma once #include "MeasurementCache.h" #include #include #include #include #include namespace facebook::react { JSI_EXPORT extern const char EnrichedMarkdownTextComponentName[]; /// ShadowNode implementing measureContent for automatic height calculation. class EnrichedMarkdownTextShadowNode : public ConcreteViewShadowNode { public: using ConcreteViewShadowNode::ConcreteViewShadowNode; EnrichedMarkdownTextShadowNode(const ShadowNodeFragment &fragment, const ShadowNodeFamily::Shared &family, ShadowNodeTraits traits); EnrichedMarkdownTextShadowNode(const ShadowNode &sourceShadowNode, const ShadowNodeFragment &fragment); void dirtyLayoutIfNeeded(); Size measureContent(const LayoutContext &layoutContext, const LayoutConstraints &layoutConstraints) const override; static ShadowNodeTraits BaseTraits() { auto traits = ConcreteViewShadowNode::BaseTraits(); traits.set(ShadowNodeTraits::Trait::LeafYogaNode); traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode); return traits; } private: int localHeightRecalculationCounter_{0}; mutable int lastExactMeasurementCounter_{0}; mutable CGSize lastExactMeasurementSize_{0, 0}; }; } // namespace facebook::react