Skip to content

Instantly share code, notes, and snippets.

@andrei4002
Created March 2, 2017 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrei4002/f1100519f11cb682f8294ef784974666 to your computer and use it in GitHub Desktop.
Save andrei4002/f1100519f11cb682f8294ef784974666 to your computer and use it in GitHub Desktop.
- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
_node1.style.preferredSize = CGSizeMake(constrainedSize.max.width, 200);
_node2.style.preferredSize = CGSizeMake(constrainedSize.max.width, 40);
_node3.style.height = _currentState == StateTypeSmall ? ASDimensionMakeWithPoints(300) : ASDimensionMakeWithPoints(450);
ASDisplayNode *spacer = [][ASDisplayNode alloc] init];
spacer.style.flexGrow = 1.0;
return [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical
spacing:0
justifyContent:ASStackLayoutJustifyContentStart
alignItems:ASStackLayoutAlignItemsStretch
children:@[
_node1,
_node2,
_spacer,
_node3
]];
}
- (void) testButton {
_currentState = _currentState == StateTypeSmall ? StateTypeLarge : StateTypeSmall;
[self setNeedsLayout];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment