From 3a3ecc40d50b90a2a4dfe5a44f418d16ea942a50 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 8 Aug 2016 03:28:42 -0700 Subject: [PATCH] Make sure layout happens after setFrame:forView: Reviewed By: majak Differential Revision: D3682745 fbshipit-source-id: 108ff292aa79765d8e5bb7fc364717eba662c0ea --- React/Modules/RCTUIManager.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 538428c0286..264c01950fc 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -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]; }); }