You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by mo...@apache.org on 2019/09/30 03:17:13 UTC

[incubator-weex] 01/01: [iOS] Protect endless iteration when setting index for slider view.

This is an automated email from the ASF dual-hosted git repository.

moshen pushed a commit to branch double11-fix5
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git

commit cb7fe03233744d34849c92b1cc20be2a5a86e4a8
Author: qianyuan.wqy <qi...@taobao.com>
AuthorDate: Mon Sep 30 11:16:57 2019 +0800

    [iOS] Protect endless iteration when setting index for slider view.
---
 ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm
index 865778c..d3ba26c 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Component/WXCycleSliderComponent.mm
@@ -148,6 +148,10 @@ typedef NS_ENUM(NSInteger, Direction) {
 
 - (void)setCurrentIndex:(NSInteger)currentIndex
 {
+    if (_currentIndex == currentIndex) {
+        return;
+    }
+    
     if (currentIndex >= _itemViews.count || currentIndex < 0) {
         currentIndex = 0;
     }