Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 72eb924

Browse files
committed
replace missing layoutSpecThatFits method
1 parent 17bd3ac commit 72eb924

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

examples/LayoutSpecExamples/Sample/LayoutExampleNodes.m

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,28 @@ - (instancetype)init
7777
return self;
7878
}
7979

80+
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
81+
{
82+
83+
ASStackLayoutSpec *nameLocationStack = [ASStackLayoutSpec verticalStackLayoutSpec];
84+
nameLocationStack.style.flexShrink = 1.0;
85+
nameLocationStack.style.flexGrow = 1.0;
86+
87+
if (_postLocationNode.attributedText) {
88+
nameLocationStack.children = @[_usernameNode, _postLocationNode];
89+
} else {
90+
nameLocationStack.children = @[_usernameNode];
91+
}
92+
93+
ASStackLayoutSpec *headerStackSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal
94+
spacing:40
95+
justifyContent:ASStackLayoutJustifyContentStart
96+
alignItems:ASStackLayoutAlignItemsCenter
97+
children:@[nameLocationStack, _postTimeNode]];
98+
99+
return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(0, 10, 0, 10) child:headerStackSpec];
100+
}
101+
80102
@end
81103

82104

0 commit comments

Comments
 (0)