Skip to content

Commit

Permalink
feat(ios): add description for componentmap
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonelmy authored and hippy-actions[bot] committed Aug 28, 2023
1 parent bf0548a commit cb186d8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions renderer/native/ios/renderer/NativeRenderComponentMap.mm
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,21 @@ - (void)removeComponentByComponentTag:(NSNumber *)componentTag onRootTag:(NSNumb
return nil;
}

- (NSString *)description {
NSMutableString *description = [NSMutableString stringWithCapacity:256];
[description appendFormat:@"<NativeRenderComponentMap %p contains ", self];
NSArray<id<NativeRenderComponentProtocol>> *rootComponentsArray = [self rootComponents];
[description appendFormat:@"%ld root component(s): ", [rootComponentsArray count]];
long index = 1;
for (id<NativeRenderComponentProtocol> object in rootComponentsArray) {
NSMutableString *objectDescription = [NSMutableString stringWithCapacity:64];
NSNumber *componentTag = [object componentTag];
NSUInteger count = [[self componentsForRootTag:componentTag] count];
[objectDescription appendFormat:@"%ld-<Root Component %p-%@ contains %ld subcomponents>;", index++, object, componentTag, count];
[description appendString:objectDescription];
}
[description appendString:@">"];
return [description copy];
}

@end

0 comments on commit cb186d8

Please sign in to comment.