Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8479] iOS: Event touchStart is not triggered when beginning a scroll in a scrollableView containing a scrollView

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 1.8.2
Fix Version/sn/a
ComponentsiOS
Labelsn/a
Reporterprocess
AssigneeUnknown
Created2012-03-07T03:03:47.000+0000
Updated2018-02-28T20:03:55.000+0000

Description

1) create a scrollableView
var myScrollableView = Ti.UI.createScrollableView({
	id:'myScrollableView',
	disableBounce:true,
	width:Ti.Platform.displayCaps.platformWidth,
	height:Ti.Platform.displayCaps.platformHeight,
	zIndex:1000
});
2) create a scrollView containning 2 imageViews and add the scrollView in the scrollableView
var myScrollView = Ti.UI.createScrollView({
			left: Ti.Platform.displayCaps.platformWidth,
			top : Ti.Platform.displayCaps.platformHeight,
			zoomScale : 1,
			minZoomScale : 1,
			maxZoomScale : 2,
			width : Ti.Platform.displayCaps.platformWidth,
			height : Ti.Platform.displayCaps.platformHeight,
			contentWidth : Ti.Platform.displayCaps.platformWidth,
			contentHeight : Ti.Platform.displayCaps.platformHeight,
			showHorizontalScrollIndicator : false,
			disableBounce: true
		});

var img1 = Ti.UI.createImageView({
				preventDefaultImage: true,
				image: 'an image you what to show',
				width: Ti.Platform.displayCaps.platformWidth,
				height: Ti.Platform.displayCaps.platformHeight
			});

var img2 = Ti.UI.createImageView({
				preventDefaultImage: true,
				image: 'an image you what to show',
				width: Ti.Platform.displayCaps.platformWidth,
				height: Ti.Platform.displayCaps.platformHeight
			});

myScrollView.add(img1);
myScrollView.add(img2);
myScrollableView.add(myScrollView);
3) add an touchStart Event Listener on scrollableView or on the scrollableView
myScrollableView.addEventListener('touchstart', function(){ Ti.API.info('TOUCH START'); });

Comments

  1. Eduardo Gomez 2012-03-31

    Whether the properties of scrollView or images that are set within it obstruct the "touchStart" event. In fact that event is triggered when scrolling to a second view. See simple test case that demonstrates the "touchStart" is triggered when beginning a scroll in a scrollableView containing a scrollView:

    Repro sequence

       var win = Ti.UI.createWindow();
        
       var view1 = Ti.UI.createScrollView({});
       var view2 = Ti.UI.createView({ backgroundColor:'#246' });
       var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
        
       var scrollableView = Ti.UI.createScrollableView({
         views:[view1,view2,view3],
         showPagingControl:true
       });
        
       win.add(scrollableView);
       win.open();
       
       scrollableView.addEventListener('touchstart', function() {
       	Ti.API.info('TOUCH START');
       });
       

    Console output

       [INFO] Titanium SDK version: 1.8.2 (02/23/12 17:46 59b3a90)
       [INFO] iPhone Device family: universal
       [INFO] iPhone SDK version: 5.0
       [INFO] iPhone simulated device: iphone
       [INFO] Launching application in Simulator
       [INFO] Launched application in Simulator (4.75 seconds)
       [INFO] Found 5.0 patch installed
       [INFO] Application started
       [INFO] 1BestPractices/1.0 (1.8.2.59b3a90)
       [INFO] TOUCH START
       
    So this test case should be considered INVALID unless there is a reason to use such objects & properties as per intended before.

JSON Source