[TIMOB-26374] Android: Ti.UI.Button can't be disabled until displayed as of 6.1.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-09-14T22:25:43.000+0000 |
Affected Version/s | Release 6.1.0 |
Fix Version/s | Release 7.5.0 |
Components | Android |
Labels | android, button |
Reporter | Michael Gangolf |
Assignee | Yordan Banev |
Created | 2018-09-10T11:37:59.000+0000 |
Updated | 2018-09-23T12:58:17.000+0000 |
Description
It is not possible to disable a button via it's "enabled" property upon creation on Android:
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var btn = Ti.UI.createButton({
title: "test",
enabled: false
})
btn.addEventListener("click",function() {
alert("enabled")
});
win.add(btn);
win.open();
The button is still clickable and has the default style (touch effect). Using the setEnabled method didn't work either.
HTC A9, Android 7
Ti SDK 7.3.1.GA
I've confirmed that the "enabled" property is ignored upon creation. This has been an as issue since Titanium 6.1.0. *Work-Around:* You can enable/disable the button once its hosting window has been opened. For example...
PR: https://github.com/appcelerator/titanium_mobile/pull/10320
[~ybanev] sorry had no time to compile your PR, but does this change put the button into disabled mode? like this: https://materialdoc.com/images/raised-button-intro-v2.png
[~michael] Yes.
*Closing ticket.* Verified fix in SDK Version:
7.5.0.v20180914153007.
Button is now able to be disabled. *FR passed (Test steps):*Created a new Titanium application
Added the code in the description above in to the app
Ran the application
Button was now disabled when the application was ran
Changed the test case to match the test case in https://github.com/appcelerator/titanium_mobile/pull/10320
Button properties seem to work as intended
*Test Environment*Hi [~ybanev], I was playing with 7.5.0 today and used and older project with a drag feature:
With 7.4.0.GA it is working fine, with 7.5.0 the disabled view (touchEnabled:false) is still appearing in the touchstart event of the window. The console.log shows two elements (window and view). While I can work around that issue and use the coordinates from the correct source it would bring some changes to existing apps.