[TIMOB-10425] MobileWeb: TableView scroll event has bad data
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2017-06-26T18:42:15.000+0000 |
Affected Version/s | Release 2.1.1 |
Fix Version/s | n/a |
Components | MobileWeb |
Labels | parity |
Reporter | Arthur Evans |
Assignee | Chris Barber |
Created | 2012-08-13T13:38:36.000+0000 |
Updated | 2018-04-04T23:20:35.000+0000 |
Description
When trying to decode tableview scroll events using JSON.stringify, I am seeing some strange data.
MobileWeb is producing the totalItemCount and visibileItemCount properties that Android generates, but totalItemCount is always 1 and visibleItemCount is always 0. The firstVisibleItem property is not included at all.
Also, Mobile Web includes x and y properties with this event. These events were documented erroneously for the other platforms--neither Android nor iOS includes them. These appear to be the x,y coordinates of the user's touch, except that the y property appears to be inverted (i.e., distance from bottom instead of distance from top of view).
Run the following code to test the events. Note that after a few cycles, this code crashes on mobile web as reported in the linked bug.
Test code:
var win = Ti.UI.createWindow({
backgroundColor: 'black',
exitOnClose: true,
fullscreen: false,
title: 'TableView Demo'
});
var defaultFontSize = Ti.Platform.name === 'android' ? 16 : 14;
var tableData = [];
for (var i=1; i<=20; i++){
var row = Ti.UI.createTableViewRow({
className:'forumEvent',
selectedBackgroundColor:'white',
height:110,
title:'Row ' + i
});
tableData.push(row);
}
var tableView = Ti.UI.createTableView({
backgroundColor:'white',
data:tableData
});
tableView.addEventListener('scroll', function(evt){
Ti.API.info("Got event type[" + evt.type + "]: " + JSON.stringify(evt, function(key, value) {
if(key === 'source' || key === 'type') {
return undefined;
} else {
return value;
}
}, 2));});
win.add(tableView);
win.open();
Note: events cannot be JSON.stringified, hence the crash. I'm surprised it worked at all. The key/value pairs of interest need to be logged instead.
Marking ticket as "Won't Fix" as MobileWeb has been deprecated.
Closing as will not fix.