#pragma once #include #include #include #include #include #include #include #include namespace facebook::react { extern const char T3MarkdownTextComponentName[]; struct T3MarkdownTextParagraphStyleRange { size_t location; size_t length; Float firstLineHeadIndent; Float headIndent; Float paragraphSpacing; }; struct T3MarkdownTextAttachmentRange { size_t location; size_t length; std::string imageUri; }; struct T3MarkdownTextChipRange { size_t location; size_t length; bool isSkill; }; class T3MarkdownTextStateReal final { public: AttributedString attributedString; std::vector paragraphStyleRanges; std::vector attachmentRanges; std::vector chipRanges; }; class T3MarkdownTextShadowNode final : public ConcreteViewShadowNode< T3MarkdownTextComponentName, T3MarkdownTextProps, T3MarkdownTextEventEmitter, T3MarkdownTextStateReal> { public: using ConcreteViewShadowNode::ConcreteViewShadowNode; T3MarkdownTextShadowNode( const ShadowNode& sourceShadowNode, const ShadowNodeFragment& fragment ); static ShadowNodeTraits BaseTraits() { auto traits = ConcreteViewShadowNode::BaseTraits(); traits.set(ShadowNodeTraits::Trait::LeafYogaNode); traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode); return traits; } void layout(LayoutContext layoutContext) override; Size measureContent( const LayoutContext& layoutContext, const LayoutConstraints& layoutConstraints) const override; private: mutable AttributedString _attributedString; mutable std::vector _paragraphStyleRanges; mutable std::vector _attachmentRanges; mutable std::vector _chipRanges; }; } // namespace facebook::React