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

Commit

Permalink
View支持userInteraction属性
Browse files Browse the repository at this point in the history
  • Loading branch information
Txink committed Aug 6, 2019
1 parent 1ee8c74 commit 7cda54c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ typedef id (^WXDataBindingBlock)(NSDictionary *data, BOOL *needUpdate);
NSString * _accessibilityHintContent; // hint for the action
NSString * _groupAccessibilityChildren; // voice-over navigation order
NSString * _testId;// just for auto-test
NSString * _userInteractionEnabled;

BOOL _accessibilityMagicTapEvent;

Expand Down
15 changes: 13 additions & 2 deletions ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ - (instancetype)initWithRef:(NSString *)ref
_isViewFrameSyncWithCalculated = YES;
_ariaHidden = nil;
_accessible = nil;
_userInteractionEnabled = nil;
_accessibilityHintContent = nil;
_cancelsTouchesInView = YES;

Expand All @@ -119,6 +120,10 @@ - (instancetype)initWithRef:(NSString *)ref
}
}

if (attributes[@"userInteractionEnabled"]) {
_userInteractionEnabled = [WXConvert NSString:attributes[@"userInteractionEnabled"]];
}

if (attributes[@"ariaHidden"]) {

_ariaHidden = [WXConvert NSString:attributes[@"ariaHidden"]];
Expand Down Expand Up @@ -419,9 +424,12 @@ - (UIView *)view
if (_accessible) {
[_view setIsAccessibilityElement:[WXConvert BOOL:_accessible]];
}

if (_userInteractionEnabled) {
[_view setUserInteractionEnabled:[WXConvert BOOL:_userInteractionEnabled]];
}
if (_ariaHidden) {
[_view setAccessibilityElementsHidden:[WXConvert BOOL:_ariaHidden]];

}
if (_groupAccessibilityChildren) {
[_view setShouldGroupAccessibilityChildren:[WXConvert BOOL:_groupAccessibilityChildren]];
Expand Down Expand Up @@ -878,7 +886,10 @@ - (void)_configWXComponentA11yWithAttributes:(NSDictionary *)attributes
_groupAccessibilityChildren = [WXConvert NSString:attributes[@"groupAccessibilityChildren"]];
[self.view setShouldGroupAccessibilityChildren:[WXConvert BOOL:_groupAccessibilityChildren]];
}

if (attributes[@"userInteractionEnabled"]) {
_userInteractionEnabled = [WXConvert NSString:attributes[@"userInteractionEnabled"]];
[self.view setUserInteractionEnabled:[WXConvert BOOL:_userInteractionEnabled]];
}

if (attributes[@"testId"]) {
[self.view setAccessibilityIdentifier:[WXConvert NSString:attributes[@"testId"]]];
Expand Down

0 comments on commit 7cda54c

Please sign in to comment.