[TIMOB-16800] TiAPI: TableView - e.rowData returns different results on each platform
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-08-21T14:47:32.000+0000 |
Affected Version/s | Release 3.2.3 |
Fix Version/s | Release 6.2.0 |
Components | Android, iOS, TiAPI |
Labels | parity, qe-3.2.3 |
Reporter | Priya Agarwal |
Assignee | Hans Knöchel |
Created | 2014-04-03T11:48:23.000+0000 |
Updated | 2017-08-24T01:44:59.000+0000 |
Description
Not a regression since issue occurs on 3.2.2.GA,3.2.1.GA and 3.2.0.GA also.
e.rowData returns different data on different platform
Steps to reproduce:
1.copy paste the code given below in app.js
2.Launch the app and click on Row.
var win = Ti.UI.createWindow({
});
var data=[];
var table = Ti.UI.createTableView({
top:0,
height: "66%"
});
var row = Ti.UI.createTableViewRow({
width: Ti.UI.FILL,
backgroundColor:"red",
height: 64
});
data.push(row);
table.addEventListener("click", function (e) {
Ti.API.warn("clicked: " + JSON.stringify(e.rowData));
});
table.data = data;
win.add(table);
win.open();
Expected Result:
Both platform must show the same result.
Actual Result:
Both the platform gives different result.
On Android getting the output as:
[WARN] : clicked: {"enabled":true,"height":64,"visible":true,"backgroundColor":"red","backgroundRepeat":false,"width":"fill"}
On iOS getting the output as:
[WARN]:clicked{"width":"FILL","backgroundColor":"red","horizontalWrap":true,"height":64}
Hieu, thoughts on why this is?
I guess we want the Android behavior in iOS since it has more information? That would mean that we (just) need to expose some missing properties.
PR: https://github.com/appcelerator/titanium_mobile/pull/8526 Test-case:
Tested with this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.1.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.1.0.v20170103080657 Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2 iOS Device: 10.0 Android Device: 6.0.1 I tested this with SDK 6.1.0, but found that the outputs still differ between iOS and Android. For example, iOS shows the horizontalWrap property while Android does not. Also, Android shows touchEnabled property, while iOS does not. I needed to "enable" createTableViewRow, otherwise the row is not clickable in Android. For iOS it did not matter. See below for actual outputs: iOS:
Android:
[~amukherjee] You are correct, here are the comparisons: ||Property||iOS||Android|| |horizontalWrap|x| | |visible|x|x| |enabled|x|(Wrong value)| |backgroundColor|x|x| |width|x|x| |height|x|x| |touchEnabled| |x| |hiddenBehavior| |x| Notes:
hiddenBehavior
is Android-only, so it's not intended to be included on iOS. I fixed thetouchEnabled
one in [this commit](https://github.com/appcelerator/titanium_mobile/commit/aadb6b0d4475dc886b1c93c1febd68833affeb3a) and what we could do is addhorizontalWrap
to the Android defaults and see whyenabled
returns false on Android although (manually) specified astrue
. [~gmathews] Can you maybe help me with the latter one?Added
horizontalWrap
. PR for Android: https://github.com/appcelerator/titanium_mobile/pull/9334 https://github.com/appcelerator/titanium_mobile/pull/9335 Output:enabled
istrue
in my testVerified the fix with SDK 6.2.0.v20170823150226 & 7.0.0.v20170823165814. Closing. Below are the
rowData
outputs: *SDK 6.2.0.v20170823150226* Android:IOS:
*SDK 7.0.0.v20170823165814* Android:
IOS:
Studio Ver: 4.9.1.201707200100 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.3 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.13 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1