@@ -13,6 +13,7 @@ namespace Xamarin.Forms.Platform.iOS
13
13
{
14
14
public class SwipeViewRenderer : ViewRenderer < SwipeView , UIView >
15
15
{
16
+ const float MinimumOpenSwipeThresholdPercentage = 0.15f ; // 15%
16
17
const float OpenSwipeThresholdPercentage = 0.6f ; // 60%
17
18
const double SwipeThreshold = 250 ;
18
19
const double SwipeItemWidth = 100 ;
@@ -38,6 +39,7 @@ public class SwipeViewRenderer : ViewRenderer<SwipeView, UIView>
38
39
double _previousScrollY ;
39
40
int _previousFirstVisibleIndex ;
40
41
bool _isSwipeEnabled ;
42
+ bool _isScrollEnabled ;
41
43
bool _isResettingSwipe ;
42
44
bool _isOpen ;
43
45
bool _isDisposed ;
@@ -48,6 +50,7 @@ public SwipeViewRenderer()
48
50
SwipeView . VerifySwipeViewFlagEnabled ( nameof ( SwipeViewRenderer ) ) ;
49
51
50
52
_swipeItems = new Dictionary < ISwipeItem , object > ( ) ;
53
+ _isScrollEnabled = true ;
51
54
52
55
_tapGestureRecognizer = new UITapGestureRecognizer ( HandleTap )
53
56
{
@@ -763,7 +766,10 @@ void ProcessTouchMove(CGPoint point)
763
766
UpdateIsOpen ( _swipeOffset != 0 ) ;
764
767
765
768
if ( Math . Abs ( _swipeOffset ) > double . Epsilon )
769
+ {
770
+ IsParentScrollEnabled ( false ) ;
766
771
Swipe ( ) ;
772
+ }
767
773
768
774
RaiseSwipeChanging ( ) ;
769
775
}
@@ -779,6 +785,7 @@ void ProcessTouchUp(CGPoint point)
779
785
return ;
780
786
781
787
_isSwiping = false ;
788
+ IsParentScrollEnabled ( true ) ;
782
789
783
790
RaiseSwipeEnded ( ) ;
784
791
@@ -788,6 +795,24 @@ void ProcessTouchUp(CGPoint point)
788
795
ValidateSwipeThreshold ( ) ;
789
796
}
790
797
798
+ void IsParentScrollEnabled ( bool scrollEnabled )
799
+ {
800
+ var swipeThresholdPercent = MinimumOpenSwipeThresholdPercentage * GetSwipeThreshold ( ) ;
801
+
802
+ if ( Math . Abs ( _swipeOffset ) < swipeThresholdPercent )
803
+ return ;
804
+
805
+ if ( scrollEnabled == _isScrollEnabled )
806
+ return ;
807
+
808
+ _isScrollEnabled = scrollEnabled ;
809
+
810
+ var parent = this . GetParentOfType < UIScrollView > ( ) ;
811
+
812
+ if ( parent != null )
813
+ parent . ScrollEnabled = _isScrollEnabled ;
814
+ }
815
+
791
816
bool CanProcessTouchSwipeItems ( CGPoint point )
792
817
{
793
818
// We only invoke the SwipeItem command if we tap on the SwipeItems area
0 commit comments