Make sure layout happens after setFrame:forView:

Reviewed By: majak

Differential Revision: D3682745

fbshipit-source-id: 108ff292aa79765d8e5bb7fc364717eba662c0ea
This commit is contained in:
Pieter De Baets 2016-08-08 03:28:42 -07:00 committed by Facebook Github Bot 8
parent 02b71cb7b5
commit f35b372883
1 changed files with 9 additions and 3 deletions

View File

@ -232,7 +232,7 @@ RCT_EXPORT_MODULE()
dispatch_async(RCTGetUIManagerQueue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
object:self];
[self batchDidComplete];
[self setNeedsLayout];
});
}
@ -424,8 +424,10 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag];
RCTAssert(shadowView != nil, @"Could not locate shadow view with tag #%@", reactTag);
BOOL needsLayout = NO;
if (!CGRectEqualToRect(frame, shadowView.frame)) {
shadowView.frame = frame;
needsLayout = YES;
}
// Trigger re-layout when size flexibility changes, as the root view might grow or
@ -434,9 +436,13 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
RCTRootShadowView *rootShadowView = (RCTRootShadowView *)shadowView;
if (rootShadowView.sizeFlexibility != sizeFlexibility) {
rootShadowView.sizeFlexibility = sizeFlexibility;
[self batchDidComplete];
needsLayout = YES;
}
}
if (needsLayout) {
[self setNeedsLayout];
}
});
}
@ -451,7 +457,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void)
shadowView.intrinsicContentSize = size;
[self batchDidComplete];
[self setNeedsLayout];
});
}