#import "T3MarkdownTextRun.h" #import "T3MarkdownText.h" #import "T3MarkdownTextRunComponentDescriptor.h" #import #import #import #import "RCTFabricComponentsPlugins.h" #import "Utils.h" using namespace facebook::react; @interface T3MarkdownTextRun () @end @implementation T3MarkdownTextRun { NSString * _text; RCTBubblingEventBlock _onPress; RCTBubblingEventBlock _onLongPress; } + (ComponentDescriptorProvider)componentDescriptorProvider { return concreteComponentDescriptorProvider(); } - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { static const auto defaultProps = std::make_shared(); _props = defaultProps; } return self; } - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { const auto &oldViewProps = *std::static_pointer_cast(_props); const auto &newViewProps = *std::static_pointer_cast(props); if (newViewProps.text != oldViewProps.text) { NSString *text = [NSString stringWithUTF8String:newViewProps.text.c_str()]; _text = text; } [super updateProps:props oldProps:oldProps]; } - (void)onPress { if (_eventEmitter != nullptr) { std::dynamic_pointer_cast(_eventEmitter) ->onPress(facebook::react::T3MarkdownTextRunEventEmitter::OnPress{}); } } - (void)onLongPress { if (_eventEmitter != nullptr) { std::dynamic_pointer_cast(_eventEmitter) ->onLongPress(facebook::react::T3MarkdownTextRunEventEmitter::OnLongPress{}); } } + (BOOL)shouldBeRecycled { return NO; } Class T3MarkdownTextRunCls(void) { return T3MarkdownTextRun.class; } @end