Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26368] iOS: ScrollView on TableView, Event Listener of ScrollView does not work.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 8.0.0, Release 7.3.0
Fix Version/sn/a
ComponentsiOS
LabelsengSchedule, ios
ReporterAndreas Pingas
AssigneeVijay Singh
Created2018-09-05T14:03:55.000+0000
Updated2019-04-17T18:02:20.000+0000

Description

Please check the following example. At the first tab the Event listener does not work properly whereas on the second does. When it has ScrollView on TableView the Event Listener of ScrollView does not work and at the same time it does not work on any view that is connected on the ScrollView and also on createTableViewRow that ScrollView is connected.
function createView(e) {

	var view = Titanium.UI.createView({
		height:'400dip',
		width:'200dip',
		left:'10dip',
		right:'10dip',
		backgroundColor:e.color
	});

	view.addEventListener('click', function() {
		alert('TEST');	
	});	
		
	return(view);
}

function createTableViewRow() {
	
	var rowView = Titanium.UI.createTableViewRow({
		height:'420dip'
	});

	rowView.addEventListener('click', function() {
		alert('TEST');	
	});	
	
	var scrollView = Titanium.UI.createScrollView({
		height:'400dip',
		width:'400dip',
		top:'20dip',
		scrollType:'horizontal',
		layout:'horizontal'
	});
	
	rowView.add(scrollView);

	scrollView.add(createView({
		color:'#AAA'
	}));
	
	scrollView.add(createView({
		color:'#EEE'
	}));		

	scrollView.add(createView({
		color:'#AAA'
	}));
	
	scrollView.add(createView({
		color:'#EEE'
	}));	
	
	return(rowView);
};

function createTableView() {
	
	var rowView = Titanium.UI.createView({
		top:'0dip',
		height:'420dip'
	});

	var scrollView = Titanium.UI.createScrollView({
		height:'400dip',
		width:'400dip',
		top:'20dip',
		scrollType:'horizontal',
		layout:'horizontal'
	});
	
	rowView.add(scrollView);

	scrollView.add(createView({
		color:'#AAA'
	}));
	
	scrollView.add(createView({
		color:'#EEE'
	}));		

	scrollView.add(createView({
		color:'#AAA'
	}));
	
	scrollView.add(createView({
		color:'#EEE'
	}));	
	
	return(rowView);
};

var windowA = Ti.UI.createWindow();

var	windowB = Ti.UI.createWindow();

var tabA = Ti.UI.createTab({
	window:windowA,
	title:'Tab A'
});

var tabB = Ti.UI.createTab({
	window:windowB,
	title:'Tab B'
});
	
var tabGroup = Titanium.UI.createTabGroup({
	tabs:[tabA, tabB]
});

tabGroup.open();

var tableView = Titanium.UI.createTableView();

var tableData = [];

tableData.push(createTableViewRow());

tableView.data = tableData;

windowA.add(tableView);

windowB.add(createTableView());

Attachments

FileDateSize
IMG_0730.mov2018-09-06T11:34:50.000+00005954714

Comments

  1. Andreas Pingas 2018-09-05

    It works properly on android. The issue appears only on iOS
  2. Rakhi Mitro 2018-09-06

    [~andreas.pingas], Thanks for sharing with us. Are you experiencing this in all iOS devices? Can you share the screenshot which displays the issue properly?
  3. Andreas Pingas 2018-09-06

    On all the iOS devices. Please watch the video below. [^IMG_0730.mov]
  4. Sharif AbuDarda 2018-09-07

    Hello, I was able to reproduce the issue for iOS. The event listener on the scrollview does not fire when it's on tableview. The issue is only on iOS, Android works fine. Tested on Android emulator and io Simulator with SDK 7.3.0.GA. Thanks
  5. Vijay Singh 2018-09-10

    This problem is happening on lower sdk versions e.g < 7.0.0 as well. I'll look in this. Simpler test case from attached test case -
       var view = Titanium.UI.createView({
       	height:'400dip',
       	width:'200dip',
       	left:'10dip',
       	right:'10dip',
       	backgroundColor:'blue'
       });
       view.addEventListener('click', function() {
       	Ti.API.info('Test view');
       	alert('Test view');	
       });	
       
       var scrollView = Titanium.UI.createScrollView({
       	height:'400dip',
       	width:'400dip',
       	top:'20dip',
       	scrollType:'horizontal',
       	layout:'horizontal'
       });
       
       scrollView.add(view);
       
       var row = Titanium.UI.createTableViewRow({
       	height:'420dip'
       });
       row.addEventListener('click', function() {
       	Ti.API.info('Test row');
       	alert('Test row');	
       });	
       
       row.add(scrollView);
        
        
       var window = Ti.UI.createWindow();
        
       var tableView = Titanium.UI.createTableView();
        
       var tableData = [];
        
       tableData.push(row);
       tableView.data = tableData;
        
       window.add(tableView);
       window.open();
       
       
    Note - In [table view docs](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView), under section 'Tables and Scroll Views', this type of layouts are discouraged.
  6. Sergey Volkov 2019-04-01

    Got same here. As workaround I'm listening for 'singletap' on TableView for now.

JSON Source