From 92475273610e0098d25e76ca0e7d28c5dd584da5 Mon Sep 17 00:00:00 2001 From: Scott Moore Date: Thu, 30 Apr 2015 15:35:31 -0700 Subject: [PATCH 1/2] Added support for carouselTap message to be emitted when the carousel has an item tapped (as opposed to dragged) - which allows parents to create controls that perform actions on tap (e.g. opening a full-screen viewer). --- src/directives/rn-carousel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/directives/rn-carousel.js b/src/directives/rn-carousel.js index 69a379d..03f8567 100755 --- a/src/directives/rn-carousel.js +++ b/src/directives/rn-carousel.js @@ -481,6 +481,7 @@ // console.log('swipeEnd', 'scope.carouselIndex', scope.carouselIndex); // Prevent clicks on buttons inside slider to trigger "swipeEnd" event on touchend/mouseup if (event && !swipeMoved) { + scope.$emit( 'carouselTap', event.target ); return; } unbindMouseUpEvent(); From a5b2ae46576654bb76fcf6641aa31019c100b637 Mon Sep 17 00:00:00 2001 From: Scott Moore Date: Tue, 5 May 2015 10:11:25 -0700 Subject: [PATCH 2/2] Added handling for tap on swipe cancel. --- src/directives/rn-carousel.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/directives/rn-carousel.js b/src/directives/rn-carousel.js index 03f8567..15416ab 100755 --- a/src/directives/rn-carousel.js +++ b/src/directives/rn-carousel.js @@ -480,8 +480,11 @@ function swipeEnd(coords, event, forceAnimation) { // console.log('swipeEnd', 'scope.carouselIndex', scope.carouselIndex); // Prevent clicks on buttons inside slider to trigger "swipeEnd" event on touchend/mouseup - if (event && !swipeMoved) { - scope.$emit( 'carouselTap', event.target ); + if (event && !swipeMoved ) { + // Don't emit on cancel + if( coords.y !== undefined ) { + scope.$emit( 'carouselTap', event.target ); + } return; } unbindMouseUpEvent();