7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
10
- #import " RCTShadowText .h"
10
+ #import " RCTTextShadowView .h"
11
11
12
12
#import < React/RCTAccessibilityManager.h>
13
13
#import < React/RCTBridge.h>
18
18
#import < React/RCTUIManager.h>
19
19
#import < React/RCTUtils.h>
20
20
21
- #import " RCTShadowRawText.h"
22
- #import " RCTText.h"
21
+ #import " RCTRawTextShadowView.h"
23
22
#import " RCTTextView.h"
23
+ #import " RCTMultilineTextInputView.h"
24
24
25
25
NSString *const RCTIsHighlightedAttributeName = @" IsHighlightedAttributeName" ;
26
26
NSString *const RCTReactTagAttributeName = @" ReactTagAttributeName" ;
31
31
static CGFloat const kAutoSizeHeightErrorMargin = 0 .025f ;
32
32
static CGFloat const kAutoSizeGranularity = 0 .001f ;
33
33
34
- @implementation RCTShadowText
34
+ @implementation RCTTextShadowView
35
35
{
36
36
NSTextStorage *_cachedTextStorage;
37
37
CGFloat _cachedTextStorageWidth;
@@ -43,7 +43,7 @@ @implementation RCTShadowText
43
43
44
44
static YGSize RCTMeasure (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
45
45
{
46
- RCTShadowText *shadowText = (__bridge RCTShadowText *)YGNodeGetContext (node);
46
+ RCTTextShadowView *shadowText = (__bridge RCTTextShadowView *)YGNodeGetContext (node);
47
47
NSTextStorage *textStorage = [shadowText buildTextStorageForWidth: width widthMode: widthMode];
48
48
[shadowText calculateTextFrame: textStorage];
49
49
NSLayoutManager *layoutManager = textStorage.layoutManagers .firstObject ;
@@ -109,7 +109,7 @@ - (void)contentSizeMultiplierDidChange:(NSNotification *)note
109
109
- (NSDictionary <NSString *, id> *)processUpdatedProperties : (NSMutableSet <RCTApplierBlock> *)applierBlocks
110
110
parentProperties : (NSDictionary <NSString *, id> *)parentProperties
111
111
{
112
- if ([[self reactSuperview ] isKindOfClass: [RCTShadowText class ]]) {
112
+ if ([[self reactSuperview ] isKindOfClass: [RCTTextShadowView class ]]) {
113
113
return parentProperties;
114
114
}
115
115
@@ -122,22 +122,22 @@ - (void)contentSizeMultiplierDidChange:(NSNotification *)note
122
122
CGRect textFrame = [self calculateTextFrame: textStorage];
123
123
BOOL selectable = _selectable;
124
124
[applierBlocks addObject: ^(NSDictionary <NSNumber *, UIView *> *viewRegistry) {
125
- RCTText *view = (RCTText *)viewRegistry[self .reactTag];
125
+ RCTTextView *view = (RCTTextView *)viewRegistry[self .reactTag];
126
126
view.textFrame = textFrame;
127
127
view.textStorage = textStorage;
128
128
view.selectable = selectable;
129
129
130
130
/* *
131
131
* NOTE: this logic is included to support rich text editing inside multiline
132
132
* `<TextInput>` controls. It is required in order to ensure that the
133
- * textStorage (aka attributed string) is copied over from the RCTShadowText
134
- * to the RCTText view in time to be used to update the editable text content.
135
- * TODO: we should establish a delegate relationship betweeen RCTTextView
136
- * and its contaned RCTText element when they get inserted and get rid of this
133
+ * textStorage (aka attributed string) is copied over from the RCTTextShadowView
134
+ * to the RCTTextView view in time to be used to update the editable text content.
135
+ * TODO: we should establish a delegate relationship betweeen RCTMultilineTextInputView
136
+ * and its contaned RCTTextView element when they get inserted and get rid of this
137
137
*/
138
138
UIView *parentView = viewRegistry[parentTag];
139
139
if ([parentView respondsToSelector: @selector (performTextUpdate )]) {
140
- [(RCTTextView *)parentView performTextUpdate ];
140
+ [(RCTMultilineTextInputView *)parentView performTextUpdate ];
141
141
}
142
142
}];
143
143
@@ -308,8 +308,8 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily
308
308
CGFloat heightOfTallestSubview = 0.0 ;
309
309
NSMutableAttributedString *attributedString = [NSMutableAttributedString new ];
310
310
for (RCTShadowView *child in [self reactSubviews ]) {
311
- if ([child isKindOfClass: [RCTShadowText class ]]) {
312
- RCTShadowText *shadowText = (RCTShadowText *)child;
311
+ if ([child isKindOfClass: [RCTTextShadowView class ]]) {
312
+ RCTTextShadowView *shadowText = (RCTTextShadowView *)child;
313
313
[attributedString appendAttributedString:
314
314
[shadowText _attributedStringWithFontFamily: fontFamily
315
315
fontSize: fontSize
@@ -321,8 +321,8 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily
321
321
backgroundColor: shadowText.backgroundColor ?: backgroundColor
322
322
opacity: opacity * shadowText.opacity]];
323
323
[child setTextComputed ];
324
- } else if ([child isKindOfClass: [RCTShadowRawText class ]]) {
325
- RCTShadowRawText *shadowRawText = (RCTShadowRawText *)child;
324
+ } else if ([child isKindOfClass: [RCTRawTextShadowView class ]]) {
325
+ RCTRawTextShadowView *shadowRawText = (RCTRawTextShadowView *)child;
326
326
[attributedString appendAttributedString: [[NSAttributedString alloc ] initWithString: shadowRawText.text ?: @" " ]];
327
327
[child setTextComputed ];
328
328
} else {
@@ -340,7 +340,7 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily
340
340
if (height > heightOfTallestSubview) {
341
341
heightOfTallestSubview = height;
342
342
}
343
- // Don't call setTextComputed on this child. RCTTextManager takes care of
343
+ // Don't call setTextComputed on this child. RCTTextViewManager takes care of
344
344
// processing inline UIViews.
345
345
}
346
346
}
@@ -653,8 +653,8 @@ - (void)setAllowFontScaling:(BOOL)allowFontScaling
653
653
{
654
654
_allowFontScaling = allowFontScaling;
655
655
for (RCTShadowView *child in [self reactSubviews ]) {
656
- if ([child isKindOfClass: [RCTShadowText class ]]) {
657
- ((RCTShadowText *)child).allowFontScaling = allowFontScaling;
656
+ if ([child isKindOfClass: [RCTTextShadowView class ]]) {
657
+ ((RCTTextShadowView *)child).allowFontScaling = allowFontScaling;
658
658
}
659
659
}
660
660
[self dirtyText ];
@@ -668,8 +668,8 @@ - (void)setFontSizeMultiplier:(CGFloat)fontSizeMultiplier
668
668
_fontSizeMultiplier = 1.0 ;
669
669
}
670
670
for (RCTShadowView *child in [self reactSubviews ]) {
671
- if ([child isKindOfClass: [RCTShadowText class ]]) {
672
- ((RCTShadowText *)child).fontSizeMultiplier = fontSizeMultiplier;
671
+ if ([child isKindOfClass: [RCTTextShadowView class ]]) {
672
+ ((RCTTextShadowView *)child).fontSizeMultiplier = fontSizeMultiplier;
673
673
}
674
674
}
675
675
[self dirtyText ];
0 commit comments