[TIMOB-23275] Windows: Deprecate Ti.UI.View.enabled, rename to touchEnabled
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-05-05T13:33:53.000+0000 |
Affected Version/s | Release 5.3.0 |
Fix Version/s | Release 5.4.0 |
Components | iOS |
Labels | parity, qe-5.3.0, qe-5.4.0, windows |
Reporter | Harry Bryant |
Assignee | Christopher Williams |
Created | 2016-04-26T18:28:42.000+0000 |
Updated | 2016-06-27T17:14:55.000+0000 |
Description
While reviewing a windows ticket, implementing the enabled property for view elements, it was found that it was not implemented for iOS. This should be fixed to achieve parity between android & windows.
*TEST CODE:*
var win = Ti.UI.createWindow({});
var view1 = Ti.UI.createView({
backgroundColor: "Magenta",
enabled: true,
left: 0,
top: 50,
height: 100,
width: 100
});
view1.addEventListener('click', function() {
alert("CLICKED! 1");
});
var view2 = Ti.UI.createView({
backgroundColor: "green",
enabled: false,
top: 50,
left: 200,
height: 100,
width: 100
});
view2.addEventListener('click', function() {
alert("CLICKED! 2");
});
win.add(view1);
win.add(view2);
win.open()
Steps to Reproduce
1. Create a default classic mobile project. 2. Apply test code above to app.js file. 3. Deploy app to iOS simulator / device. 4. After launching the app, click / tap on left view. 5. Click / tap on right view.Actual Result
Left view *enabled* property is set totrue
: Alert appears when clicked.
Right view *enabled* property is set to false
: Alert appears when clicked.
Expected Result.
Left view *enabled* property is set totrue
: Alert *should* appear when clicked.
Right view *enabled* property is set to false
: Alert *should NOT* appear when clicked.
[~htbryant] On iOS the property is called touchEnabled, enabled isn't a property of the view on iOS according to the documentation. To Achieve parity we need to rename touchEnabled to enabled on iOS or rename it on Windows. Since its also called touchEnabled on android it would be best to rename the property on windows.
We used to call it
enabled
in earlier releases and introducedtouchEnabled
in both iOS and Android instead, which was a while ago. I'd prefer Windows to migrate the property, since it's a new platform. /cc [~cwilliams]I agree that it would be a better option for Windows to adopt the
touchEnabled
property.Looks like we need to rename the new "enabled" property to touchEnabled. We should probably leave "enabled", log a warning that it's deprecated and forward the call to enabled.
https://github.com/appcelerator/titanium_mobile_windows/pull/666
We retained the Ti.UI.View.enabled property and it basically just forwards the property/getter/setter to touchEnabled and logs a warning to console that enabled is deprecated, please use touchEnabled.
Verified as fixed, using the
enabled
property on windows now returns a deprecated message, and now supports thetouchEnabled
property. Tested on: Windows 10 Pro Windows Phone 10.0 (Microsoft Lumia 640 LTE) Appc Studio: 4.7.0.201606220541 Ti SDK: 5.4.0.v20160617074028 Appc NPM: 4.2.7-2 Appc Core: 5.4.0-18 Node: v4.4.4 *Closing Ticket.*