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

Commit

Permalink
[Core] Refactor. Avoid invalid cell/header height. (#1517)
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor authored and cxfeng1 committed Sep 12, 2018
1 parent aa1fe27 commit 360ad5c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 91 deletions.
5 changes: 5 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXCellComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#import "WXComponent_internal.h"
#import "WXDiffUtil.h"
#import "WXComponent+Layout.h"
#import "WXAssert.h"

@interface WXCellComponent ()

Expand Down Expand Up @@ -154,6 +155,10 @@ - (void)_assignCalculatedFrame:(CGRect)frame
else {
frame.origin.y = 0.0f; // only ignore y
}
WXAssert(!isnan(frame.size.height), @"Height of cell should not be NAN.");
if (isnan(frame.size.height) || frame.size.height < 0.0f) {
frame.size.height = 0.0f;
}
_calculatedFrame = frame;
}

Expand Down
5 changes: 5 additions & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXHeaderComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import "WXHeaderComponent.h"
#import "WXComponent_internal.h"
#import "WXComponent+Layout.h"
#import "WXAssert.h"

@implementation WXHeaderComponent
{
Expand Down Expand Up @@ -75,6 +76,10 @@ - (BOOL)_isCaculatedFrameChanged:(CGRect)frame
- (void)_assignCalculatedFrame:(CGRect)frame
{
frame.origin = CGPointZero;
WXAssert(!isnan(frame.size.height), @"Height of header should not be NAN.");
if (isnan(frame.size.height) || frame.size.height < 0.0f) {
frame.size.height = 0.0f;
}
_calculatedFrame = frame;
}

Expand Down
41 changes: 0 additions & 41 deletions ios/sdk/WeexSDK/Sources/Layout/WXLayoutConstraint.h

This file was deleted.

50 changes: 0 additions & 50 deletions ios/sdk/WeexSDK/Sources/Layout/WXLayoutConstraint.m

This file was deleted.

0 comments on commit 360ad5c

Please sign in to comment.