Merge pull request #1902 from maicki/MSFixLayoutTriggerFromSubnodeNotHappening

[ASDisplayNode] Fix setNeedsLayout triggered from subnode will not trigger relayout
This commit is contained in:
Michael Schneider
2016-07-12 11:28:14 -07:00
committed by GitHub

View File

@@ -1055,13 +1055,15 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
- (void)__setNeedsLayout
{
ASDisplayNodeAssertThreadAffinity(self);
_propertyLock.lock();
if ([self _hasDirtyLayout]) {
if (_layout == nil) {
// Can't proceed without a layout as no constrained size would be available
_propertyLock.unlock();
return;
}
[self invalidateCalculatedLayout];
if (_supernode) {
@@ -1091,6 +1093,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
CGFloat yDelta = (newSize.height - oldSize.height) * anchorPoint.y;
self.position = CGPointMake(oldPosition.x + xDelta, oldPosition.y + yDelta);
}
_propertyLock.unlock();
}