diff --git a/Libraries/Text/RawText/RCTRawTextShadowView.m b/Libraries/Text/RawText/RCTRawTextShadowView.m index 0ad4ecad42e9a3..b307c940894a85 100644 --- a/Libraries/Text/RawText/RCTRawTextShadowView.m +++ b/Libraries/Text/RawText/RCTRawTextShadowView.m @@ -24,11 +24,13 @@ - (void)dirtyLayout [self.superview dirtyLayout]; } +#if RCT_DEBUG - (NSString *)description { NSString *superDescription = super.description; return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; text: %@>", self.text]; } +#endif @end diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index cf872397a327d2..1a0cbdfc1074f1 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -36,6 +36,7 @@ - (instancetype)initWithFrame:(CGRect)frame return self; } +#if RCT_DEBUG - (NSString *)description { NSString *superDescription = super.description; @@ -43,6 +44,7 @@ - (NSString *)description NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@; text: %@>", self.reactTag, _textStorage.string]; return [superDescription stringByReplacingCharactersInRange:replacementRange withString:replacement]; } +#endif - (void)setSelectable:(BOOL)selectable { diff --git a/React/Base/RCTImageSource.m b/React/Base/RCTImageSource.m index 1741ad382913a6..1f04e83cd5191f 100644 --- a/React/Base/RCTImageSource.m +++ b/React/Base/RCTImageSource.m @@ -42,6 +42,7 @@ - (BOOL)isEqual:(RCTImageSource *)object (CGSizeEqualToSize(_size, object.size) || CGSizeEqualToSize(object.size, CGSizeZero)); } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"", @@ -50,6 +51,7 @@ - (NSString *)description NSStringFromCGSize(_size), _scale]; } +#endif @end diff --git a/React/Base/RCTJSStackFrame.m b/React/Base/RCTJSStackFrame.m index 7d1e1e85974f85..575c25fcc3b2c3 100644 --- a/React/Base/RCTJSStackFrame.m +++ b/React/Base/RCTJSStackFrame.m @@ -136,6 +136,7 @@ + (instancetype)stackFrameWithDictionary:(NSDictionary *)dict return stack; } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p method name: %@; file name: %@; line: %ld; column: %ld>", @@ -146,5 +147,6 @@ - (NSString *)description (long)self.lineNumber, (long)self.column]; } +#endif @end diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index 133851a1d7f49d..3a5ca59110bab0 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -56,6 +56,7 @@ @implementation RCTSource @implementation RCTLoadingProgress +#if RCT_DEBUG - (NSString *)description { NSMutableString *desc = [NSMutableString new]; @@ -71,6 +72,7 @@ - (NSString *)description [desc appendString:@"\u2026"]; return desc; } +#endif @end diff --git a/React/Base/RCTKeyCommands.m b/React/Base/RCTKeyCommands.m index 1ceaf6ec0dceb1..d2e77ecb4fc137 100644 --- a/React/Base/RCTKeyCommands.m +++ b/React/Base/RCTKeyCommands.m @@ -74,6 +74,7 @@ - (BOOL)matchesInput:(NSString *)input flags:(UIKeyModifierFlags)flags return [_key isEqual:input] && (_flags == flags || flags == 0); } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%lld hasBlock=%@>", @@ -83,6 +84,7 @@ - (NSString *)description (long long)_flags, _block ? @"YES" : @"NO"]; } +#endif @end diff --git a/React/Base/RCTModuleData.mm b/React/Base/RCTModuleData.mm index 3e7fd3e7f76bc8..aef367a42af2bb 100644 --- a/React/Base/RCTModuleData.mm +++ b/React/Base/RCTModuleData.mm @@ -505,9 +505,11 @@ - (void)invalidate _methodQueue = nil; } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; name=\"%@\">", [self class], self, self.name]; } +#endif @end diff --git a/React/Base/RCTModuleMethod.mm b/React/Base/RCTModuleMethod.mm index f2d32d9aaf708f..31d98ef23a3511 100644 --- a/React/Base/RCTModuleMethod.mm +++ b/React/Base/RCTModuleMethod.mm @@ -602,6 +602,7 @@ - (NSString *)methodName return [NSString stringWithFormat:@"-[%@ %s]", _moduleClass, sel_getName(_selector)]; } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; exports %@ as %s(); type: %s>", @@ -611,5 +612,6 @@ - (NSString *)description self.JSMethodName, RCTFunctionDescriptorFromType(self.functionType)]; } +#endif @end diff --git a/React/Base/RCTTouchEvent.m b/React/Base/RCTTouchEvent.m index 4fb743f454bd92..8e5f6f51e8d56c 100644 --- a/React/Base/RCTTouchEvent.m +++ b/React/Base/RCTTouchEvent.m @@ -98,10 +98,12 @@ - (uint16_t)coalescingKey return _coalescingKey; } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; name = %@; coalescing key = %hu>", [self class], self, _eventName, _coalescingKey]; } +#endif @end diff --git a/React/CxxModule/RCTCxxMethod.mm b/React/CxxModule/RCTCxxMethod.mm index 4fc4a2abbc39c9..2dad46a7b229b4 100644 --- a/React/CxxModule/RCTCxxMethod.mm +++ b/React/CxxModule/RCTCxxMethod.mm @@ -131,9 +131,11 @@ - (id)invokeWithBridge:(RCTBridge *)bridge module:(id)module arguments:(NSArray } } +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; name = %s>", [self class], self, self.JSMethodName]; } +#endif @end diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 5903f966375d3a..7bd6a4a73883e2 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -44,6 +44,7 @@ - (instancetype)initWithFrame:(CGRect)frame return self; } +#if RCT_DEBUG - (NSString *)description { NSString *superDescription = [super description]; @@ -55,6 +56,7 @@ - (NSString *)description return [NSString stringWithFormat:@"%@; attributedText = %@>", superDescription, self.attributedText]; } +#endif - (NSAttributedString *_Nullable)attributedText { diff --git a/React/Modules/RCTLayoutAnimation.m b/React/Modules/RCTLayoutAnimation.m index d88fa0fba699ae..20f42dc0b383fe 100644 --- a/React/Modules/RCTLayoutAnimation.m +++ b/React/Modules/RCTLayoutAnimation.m @@ -134,6 +134,7 @@ - (BOOL)isEqual:(RCTLayoutAnimation *)animation _animationType == animation.animationType; } +#if RCT_DEBUG - (NSString *)description { return [NSString @@ -148,5 +149,6 @@ - (NSString *)description _initialVelocity, (long)_animationType]; } +#endif @end diff --git a/React/Modules/RCTLayoutAnimationGroup.m b/React/Modules/RCTLayoutAnimationGroup.m index 88f9f58260104b..4549f8345e14c8 100644 --- a/React/Modules/RCTLayoutAnimationGroup.m +++ b/React/Modules/RCTLayoutAnimationGroup.m @@ -64,6 +64,7 @@ - (BOOL)isEqual:(RCTLayoutAnimationGroup *)layoutAnimation [_deletingLayoutAnimation isEqual:deletingLayoutAnimation]); } +#if RCT_DEBUG - (NSString *)description { return @@ -75,5 +76,6 @@ - (NSString *)description [_updatingLayoutAnimation description], [_deletingLayoutAnimation description]]; } +#endif @end diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index baca3cef65e4bf..8a474b31035e89 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -383,6 +383,7 @@ - (NSNumber *)reactTagAtPoint:(CGPoint)point return self.reactTag; } +#if RCT_DEBUG - (NSString *)description { NSString *description = super.description; @@ -393,6 +394,7 @@ - (NSString *)description NSStringFromCGRect(self.layoutMetrics.frame)]; return description; } +#endif - (void)addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level { diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index eb30e9da667843..a11ad3963e92e4 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -450,6 +450,7 @@ - (void)accessibilityDecrement [self performAccessibilityAction:@"decrement"]; } +#if RCT_DEBUG - (NSString *)description { NSString *superDescription = super.description; @@ -457,6 +458,7 @@ - (NSString *)description NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@;", self.reactTag]; return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement]; } +#endif #pragma mark - Statics for dealing with layoutGuides diff --git a/React/Views/SafeAreaView/RCTSafeAreaView.m b/React/Views/SafeAreaView/RCTSafeAreaView.m index 41dc74b06b66be..4ffa684607ee7c 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaView.m +++ b/React/Views/SafeAreaView/RCTSafeAreaView.m @@ -29,6 +29,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder) RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) +#if RCT_DEBUG - (NSString *)description { NSString *superDescription = [super description]; @@ -43,6 +44,7 @@ - (NSString *)description NSStringFromUIEdgeInsets(self.safeAreaInsets), NSStringFromUIEdgeInsets(_currentSafeAreaInsets)]; } +#endif static BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold) { diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m index 48d51fa52990a2..2f92df4c7c4f0f 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m @@ -53,10 +53,12 @@ - (instancetype)initWithTestName:(NSString *)testName #pragma mark - Properties +#if RCT_DEBUG - (NSString *)description { return [NSString stringWithFormat:@"%@ %@", [super description], _referenceImagesDirectory]; } +#endif #pragma mark - Public API