mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix exception thrown by [RCTTextView description] on macOS
Summary: This method assumes a semicolon existed before the closing bracket (`>`), but only does on iOS. This instead puts the content before the closing bracket, which is always there on both platforms. Changelog: [macOS][Fixed] - Fix exception thrown by [RCTTextView description] on macOS Reviewed By: sammy-SC Differential Revision: D38074642 fbshipit-source-id: f46d15c2bf2d966d1c1430568f083e4d501d4b40
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e7a8d21df5
commit
7db6c080f5
@@ -38,9 +38,9 @@
|
||||
- (NSString *)description
|
||||
{
|
||||
NSString *superDescription = super.description;
|
||||
NSRange semicolonRange = [superDescription rangeOfString:@";"];
|
||||
NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@; text: %@", self.reactTag, _textStorage.string];
|
||||
return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement];
|
||||
NSRange replacementRange = [superDescription rangeOfString:@">"];
|
||||
NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@; text: %@>", self.reactTag, _textStorage.string];
|
||||
return [superDescription stringByReplacingCharactersInRange:replacementRange withString:replacement];
|
||||
}
|
||||
|
||||
- (void)setSelectable:(BOOL)selectable
|
||||
@@ -113,7 +113,7 @@
|
||||
// CATextLayer disables font smoothing by default now on macOS; we follow suit.
|
||||
CGContextSetShouldSmoothFonts(context, NO);
|
||||
#endif
|
||||
|
||||
|
||||
NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
|
||||
[layoutManager drawBackgroundForGlyphRange:glyphRange atPoint:_contentFrame.origin];
|
||||
[layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:_contentFrame.origin];
|
||||
@@ -157,7 +157,7 @@
|
||||
[_highlightLayer removeFromSuperlayer];
|
||||
_highlightLayer = nil;
|
||||
}
|
||||
|
||||
|
||||
#if TARGET_OS_MACCATALYST
|
||||
CGContextRestoreGState(context);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user