Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] [Bugfix] fix view.frame is not accessed in main thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
晨燕 committed Dec 13, 2018
1 parent c84e431 commit 6aaa4b2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -724,16 +724,15 @@ - (void)layoutComponent:(WXComponent*)component frame:(CGRect)frame isRTL:(BOOL)

[component _setIsLayoutRTL:isRTL];
if (component == _rootComponent) {
if (!CGSizeEqualToSize(frame.size, self.weexInstance.frame.size) || !CGSizeEqualToSize(frame.size, self.weexInstance.rootView.frame.size)) {
// Synchronize view frame with root component, especially for content wrap mode.
WXPerformBlockOnMainThread(^{
if (!self.weexInstance.isRootViewFrozen) {
CGRect rect = self.weexInstance.rootView.frame; // no change of origin
rect.size = frame.size;
self.weexInstance.rootView.frame = rect;
}
});
}
// Synchronize view frame with root component, especially for content wrap mode.
WXPerformBlockOnMainThread(^{
if (!self.weexInstance.isRootViewFrozen &&
(!CGSizeEqualToSize(frame.size, self.weexInstance.frame.size) || !CGSizeEqualToSize(frame.size, self.weexInstance.rootView.frame.size))) {
CGRect rect = self.weexInstance.rootView.frame; // no change of origin
rect.size = frame.size;
self.weexInstance.rootView.frame = rect;
}
});
}

if ([component _isCalculatedFrameChanged:frame]) {
Expand Down

0 comments on commit 6aaa4b2

Please sign in to comment.