@@ -58,6 +58,7 @@ @interface WXRecycleSliderView : UIView <UIScrollViewDelegate>
58
58
@property (nonatomic , assign ) CGRect currentItemFrame;
59
59
@property (nonatomic , assign ) CGRect nextItemFrame;
60
60
@property (nonatomic , assign ) BOOL infinite;
61
+ @property (nonatomic , assign ) BOOL forbidSlideAnimation;
61
62
62
63
- (void )insertItemView : (UIView *)view atIndex : (NSInteger )index ;
63
64
- (void )removeItemView : (UIView *)view ;
@@ -168,7 +169,7 @@ - (void)setCurrentIndex:(NSInteger)currentIndex
168
169
}
169
170
[self resetAllViewsFrame ];
170
171
} else {
171
- [_scrollView setContentOffset: CGPointMake (_currentIndex * self .width, 0 ) animated: YES ];
172
+ [_scrollView setContentOffset: CGPointMake (_currentIndex * self .width, 0 ) animated: !_forbidSlideAnimation ];
172
173
}
173
174
[self resetIndicatorPoint ];
174
175
if (self.delegate && [self .delegate respondsToSelector: @selector (recycleSliderView:didScrollToItemAtIndex: )]) {
@@ -248,12 +249,12 @@ - (void)resetAllViewsFrame
248
249
- (void )nextPage {
249
250
if (_itemViews.count > 1 ) {
250
251
if (_infinite) {
251
- [self .scrollView setContentOffset: CGPointMake (self .width * 2 , 0 ) animated: YES ];
252
+ [self .scrollView setContentOffset: CGPointMake (self .width * 2 , 0 ) animated: !_forbidSlideAnimation ];
252
253
} else {
253
254
// the currentindex will be set at the end of animation
254
255
NSInteger nextIndex = self.currentIndex + 1 ;
255
256
if (nextIndex < _itemViews.count ) {
256
- [self .scrollView setContentOffset: CGPointMake (nextIndex * self .width, 0 ) animated: YES ];
257
+ [self .scrollView setContentOffset: CGPointMake (nextIndex * self .width, 0 ) animated: !_forbidSlideAnimation ];
257
258
}
258
259
}
259
260
}
@@ -391,6 +392,7 @@ @interface WXCycleSliderComponent () <WXRecycleSliderViewDelegate,WXIndicatorCom
391
392
@property (nonatomic , strong ) NSMutableArray *childrenView;
392
393
@property (nonatomic , assign ) BOOL scrollable;
393
394
@property (nonatomic , assign ) BOOL infinite;
395
+ @property (nonatomic , assign ) BOOL forbidSlideAnimation;
394
396
395
397
@end
396
398
@@ -426,6 +428,9 @@ - (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDict
426
428
_offsetXAccuracy = [WXConvert CGFloat: attributes[@" offsetXAccuracy" ]];
427
429
}
428
430
_infinite = attributes[@" infinite" ] ? [WXConvert BOOL: attributes[@" infinite" ]] : YES ;
431
+
432
+ _forbidSlideAnimation = attributes[@" forbidSlideAnimation" ] ? [WXConvert BOOL: attributes[@" forbidSlideAnimation" ]] : NO ;
433
+
429
434
self.flexCssNode ->setFlexDirection (WeexCore::kFlexDirectionRow ,NO );
430
435
}
431
436
return self;
@@ -446,6 +451,7 @@ - (void)viewDidLoad
446
451
_recycleSliderView.exclusiveTouch = YES ;
447
452
_recycleSliderView.scrollView .scrollEnabled = _scrollable;
448
453
_recycleSliderView.infinite = _infinite;
454
+ _recycleSliderView.forbidSlideAnimation = _forbidSlideAnimation;
449
455
UIAccessibilityTraits traits = UIAccessibilityTraitAdjustable;
450
456
if (_autoPlay) {
451
457
traits |= UIAccessibilityTraitUpdatesFrequently;
@@ -569,6 +575,11 @@ - (void)willRemoveSubview:(WXComponent *)component
569
575
570
576
- (void )updateAttributes : (NSDictionary *)attributes
571
577
{
578
+ if (attributes[@" forbidSlideAnimation" ]) {
579
+ _forbidSlideAnimation = [WXConvert BOOL: attributes[@" forbidSlideAnimation" ]];
580
+ _recycleSliderView.forbidSlideAnimation = _forbidSlideAnimation;
581
+ }
582
+
572
583
if (attributes[@" autoPlay" ]) {
573
584
_autoPlay = [WXConvert BOOL: attributes[@" autoPlay" ]];
574
585
if (_autoPlay) {
0 commit comments