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

Revert "[iOS] Set overflow to hidden by default on iOS to conform to… #2565

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,6 @@ - (BOOL)_handleConfigCenter
if ([configCenter respondsToSelector:@selector(configForKey:defaultValue:isDefault:)]) {
BOOL enableRTLLayoutDirection = [[configCenter configForKey:@"iOS_weex_ext_config.enableRTLLayoutDirection" defaultValue:@(YES) isDefault:NULL] boolValue];
[WXUtility setEnableRTLLayoutDirection:enableRTLLayoutDirection];

BOOL overflowHiddenByDefault = [[configCenter configForKey:@"iOS_weex_ext_config.overflowHiddenByDefault" defaultValue:@(YES) isDefault:NULL] boolValue];
[WXUtility setOverflowHiddenByDefault:overflowHiddenByDefault];
}
return NO;
}
Expand Down
4 changes: 1 addition & 3 deletions ios/sdk/WeexSDK/Sources/Utility/WXUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,8 @@ BOOL WXFloatGreaterThanWithPrecision(CGFloat a,CGFloat b,double precision);
+ (NSData *_Nonnull)base64DictToData:(NSDictionary *_Nullable)base64Dict;

+ (void)setEnableRTLLayoutDirection:(BOOL)value;
+ (BOOL)enableRTLLayoutDirection;

+ (void)setOverflowHiddenByDefault:(BOOL)value;
+ (BOOL)overflowHiddenByDefault;
+ (BOOL)enableRTLLayoutDirection;

+ (long) getUnixFixTimeMillis;

Expand Down
13 changes: 0 additions & 13 deletions ios/sdk/WeexSDK/Sources/Utility/WXUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#define KEY_USERNAME_PASSWORD @"com.taobao.Weex.weex123456"

static BOOL enableRTLLayoutDirection = YES;
static BOOL overflowHiddenByDefault = YES;

void WXPerformBlockOnMainThread(void (^ _Nonnull block)(void))
{
Expand Down Expand Up @@ -771,18 +770,6 @@ + (BOOL)enableRTLLayoutDirection
return enableRTLLayoutDirection;
}

# pragma mark - Overflow

+ (void)setOverflowHiddenByDefault:(BOOL)value
{
overflowHiddenByDefault = value;
}

+ (BOOL)overflowHiddenByDefault
{
return overflowHiddenByDefault;
}

#pragma mark - get deviceID
+ (NSString *)getDeviceID {
NSMutableDictionary *usernamepasswordKVPairs = (NSMutableDictionary *)[self load:KEY_USERNAME_PASSWORD];
Expand Down
24 changes: 4 additions & 20 deletions ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.mm
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,7 @@ - (void)_initViewPropertyWithStyles:(NSDictionary *)styles
_backgroundColor = styles[@"backgroundColor"] ? [WXConvert UIColor:styles[@"backgroundColor"]] : [UIColor clearColor];
_backgroundImage = styles[@"backgroundImage"] ? [WXConvert NSString:styles[@"backgroundImage"]]: nil;
_opacity = styles[@"opacity"] ? [WXConvert CGFloat:styles[@"opacity"]] : 1.0;
if ([WXUtility overflowHiddenByDefault]) {
/* If we enable overflow:hidden by default, we cannot use original "overflow" style value.
Unless js explicitly define "ios-overflow: visible", we disable clipToBounds.
*/
_clipToBounds = styles[@"iosOverflow"] ? [WXConvert WXClipType:styles[@"iosOverflow"]] : YES;
}
else {
_clipToBounds = styles[@"overflow"] ? [WXConvert WXClipType:styles[@"overflow"]] : NO;
}
_clipToBounds = styles[@"overflow"] ? [WXConvert WXClipType:styles[@"overflow"]] : NO;
_visibility = styles[@"visibility"] ? [WXConvert WXVisibility:styles[@"visibility"]] : WXVisibilityShow;
_positionType = styles[@"position"] ? [WXConvert WXPositionType:styles[@"position"]] : WXPositionTypeRelative;
_transform = styles[@"transform"] || styles[@"transformOrigin"] ?
Expand Down Expand Up @@ -235,17 +227,9 @@ - (void)_updateViewStyles:(NSDictionary *)styles
_layer.opacity = _opacity;
}

if ([WXUtility overflowHiddenByDefault]) {
if (styles[@"iosOverflow"]) {
_clipToBounds = [WXConvert WXClipType:styles[@"iosOverflow"]];
_view.clipsToBounds = _clipToBounds;
}
}
else {
if (styles[@"overflow"]) {
_clipToBounds = [WXConvert WXClipType:styles[@"overflow"]];
_view.clipsToBounds = _clipToBounds;
}
if (styles[@"overflow"]) {
_clipToBounds = [WXConvert WXClipType:styles[@"overflow"]];
_view.clipsToBounds = _clipToBounds;
}

if (styles[@"position"]) {
Expand Down
1 change: 1 addition & 0 deletions ios/sdk/WeexSDKTests/WXComponentTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ - (void)testDefaultProperties
* View
*/
XCTAssertEqual(component->_backgroundColor, [UIColor clearColor]);
XCTAssertEqual(component->_clipToBounds, NO);
XCTAssertNil(component->_view);
XCTAssertEqual(component->_opacity, 1.0);
XCTAssertEqual(component->_visibility, WXVisibilityShow);
Expand Down