wqyfavor closed pull request #1854: [iOS] [BugFix] Fix remove active pseudo class doesn't work. URL: https://github.com/apache/incubator-weex/pull/1854
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm index 0bd71bc1b3..7a1c59eb42 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm +++ b/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm @@ -376,7 +376,7 @@ - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView { @interface WXCycleSliderComponent () <WXRecycleSliderViewDelegate,WXIndicatorComponentDelegate> -@property (nonatomic, strong) WXRecycleSliderView *recycleSliderView; +@property (nonatomic, weak) WXRecycleSliderView *recycleSliderView; @property (nonatomic, strong) NSTimer *autoTimer; @property (nonatomic, assign) NSInteger currentIndex; @property (nonatomic, assign) BOOL autoPlay; diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm index f69f506a4e..c3370be47c 100644 --- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm +++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm @@ -680,6 +680,7 @@ - (void)_updateStylesOnComponentThread:(NSDictionary *)styles resetStyles:(NSMut [_transition _handleTransitionWithStyles:[styles mutableCopy] resetStyles:resetStyles target:self]; } else { styles = [self parseStyles:styles]; + [self resetPseudoClassStyles:resetStyles]; [self _updateCSSNodeStyles:styles]; [self _resetCSSNodeStyles:resetStyles]; } diff --git a/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.h b/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.h index f3b3adc4ad..79d8a299d4 100644 --- a/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.h +++ b/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.h @@ -27,6 +27,12 @@ */ -(NSMutableDictionary *)parseStyles:(NSDictionary *)styles; +/** + * @abstract reset pseudoClassStyles. + * + */ +- (void)resetPseudoClassStyles:(NSArray *)resetstyle; + /** * @abstract filter common styles and pseudoClassStyles. * diff --git a/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.m b/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.m index 36da6b0d11..c51b4dc420 100644 --- a/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.m +++ b/ios/sdk/WeexSDK/Sources/View/WXComponent+PseudoClassManagement.m @@ -47,6 +47,17 @@ -(NSMutableDictionary *)parseStyles:(NSDictionary *)styles return newStyles; } +- (void)resetPseudoClassStyles:(NSArray *)resetstyle { + for (NSString* key in resetstyle) { + if([key rangeOfString:@":"].location != NSNotFound){ + [_pseudoClassStyles removeObjectForKey:key]; + } + } + if([_pseudoClassStyles count] == 0) { + _isListenPseudoTouch = NO; + } +} + - (void)updatePseudoClassStyles:(NSDictionary *)pseudoClassStyles { WXAssertMainThread(); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services