From 8f13560fd58eaaa2029f025e2c721268efdbd17d Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Fri, 25 Sep 2015 11:36:13 -0700 Subject: [PATCH] End slider interaction when touches are cancelled Reviewed By: @jingc Differential Revision: D2479259 --- React/Base/RCTTouchHandler.m | 2 +- React/Views/RCTSliderManager.m | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/React/Base/RCTTouchHandler.m b/React/Base/RCTTouchHandler.m index 5c6333f21..eb902b8eb 100644 --- a/React/Base/RCTTouchHandler.m +++ b/React/Base/RCTTouchHandler.m @@ -242,7 +242,7 @@ static BOOL RCTAnyTouchesChanged(NSSet *touches) { [super touchesBegan:touches withEvent:event]; - // "start" has to record new touches beforeckirjiuhucekbebjditeucultigvijfe extracting the event. + // "start" has to record new touches before extracting the event. // "end"/"cancel" needs to remove the touch *after* extracting the event. [self _recordNewTouches:touches]; if (_dispatchedInitialTouches) { diff --git a/React/Views/RCTSliderManager.m b/React/Views/RCTSliderManager.m index 694e8855b..60f65aa68 100644 --- a/React/Views/RCTSliderManager.m +++ b/React/Views/RCTSliderManager.m @@ -22,8 +22,9 @@ RCT_EXPORT_MODULE() { RCTSlider *slider = [RCTSlider new]; [slider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged]; - [slider addTarget:self action:@selector(sliderTouchEnd:) forControlEvents:UIControlEventTouchUpInside]; - [slider addTarget:self action:@selector(sliderTouchEnd:) forControlEvents:UIControlEventTouchUpOutside]; + [slider addTarget:self action:@selector(sliderTouchEnd:) forControlEvents:(UIControlEventTouchUpInside | + UIControlEventTouchUpOutside | + UIControlEventTouchCancel)]; return slider; }