Created
March 2, 2017 09:36
-
-
Save andrei4002/f1100519f11cb682f8294ef784974666 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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