@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
mm 54 lines 1.42 KB
Raw
1 #import "T3SourceTextRun.h"
2 #import <React/RCTFabricComponentsPlugins.h>
3 #import "T3SourceTextRunComponentDescriptor.h"
4 #import <react/renderer/components/T3SourceTextSpec/Props.h>
5 #import <react/renderer/components/T3SourceTextSpec/RCTComponentViewHelpers.h>
6
7 using namespace facebook::react;
8
9 @interface T3SourceTextRun () <RCTT3SourceTextRunViewProtocol>
10
11 @end
12
13 @implementation T3SourceTextRun {
14 NSString *_text;
15 }
16
17 + (ComponentDescriptorProvider)componentDescriptorProvider {
18 return concreteComponentDescriptorProvider<
19 T3SourceTextRunComponentDescriptor>();
20 }
21
22 - (instancetype)initWithFrame:(CGRect)frame {
23 if (self = [super initWithFrame:frame]) {
24 static const auto defaultProps =
25 std::make_shared<const T3SourceTextRunProps>();
26 _props = defaultProps;
27 }
28 return self;
29 }
30
31 - (void)updateProps:(Props::Shared const &)props
32 oldProps:(Props::Shared const &)oldProps {
33 const auto &oldViewProps =
34 *std::static_pointer_cast<T3SourceTextRunProps const>(_props);
35 const auto &newViewProps =
36 *std::static_pointer_cast<T3SourceTextRunProps const>(props);
37
38 if (newViewProps.text != oldViewProps.text) {
39 NSString *text = [NSString stringWithUTF8String:newViewProps.text.c_str()];
40 _text = text;
41 }
42
43 [super updateProps:props oldProps:oldProps];
44 }
45
46 + (BOOL)shouldBeRecycled {
47 return NO;
48 }
49
50 Class<RCTComponentViewProtocol> T3SourceTextRunCls(void) {
51 return T3SourceTextRun.class;
52 }
53
54 @end