Skip to content

Commit

Permalink
Yoga debug info (#1253)
Browse files Browse the repository at this point in the history
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a1.

* Add description method for yoga.

* Fix comment
  • Loading branch information
wsdwsd0829 authored and maicki committed Dec 10, 2018
1 parent 82b4d34 commit 1d4b4c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/ASDisplayNode+Beta.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ AS_EXTERN void ASDisplayNodePerformBlockOnEveryYogaChild(ASDisplayNode * _Nullab

@end

@interface ASDisplayNode (YogaDebugging)

- (NSString *)yogaTreeDescription;

@end

@interface ASLayoutElementStyle (Yoga)

- (YGNodeRef)yogaNodeCreateIfNeeded;
Expand Down
16 changes: 16 additions & 0 deletions Source/ASDisplayNode+Yoga.mm
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,20 @@ - (void)calculateLayoutFromYogaRoot:(ASSizeRange)rootConstrainedSize

@end

@implementation ASDisplayNode (YogaDebugging)

- (NSString *)yogaTreeDescription {
return [self _yogaTreeDescription:@""];
}

- (NSString *)_yogaTreeDescription:(NSString *)indent {
auto subtree = [NSMutableString stringWithFormat:@"%@%@\n", indent, self.description];
for (ASDisplayNode *n in self.yogaChildren) {
[subtree appendString:[n _yogaTreeDescription:[indent stringByAppendingString:@"| "]]];
}
return subtree;
}

@end

#endif /* YOGA */

0 comments on commit 1d4b4c7

Please sign in to comment.