[TIMOB-25977] Android: AlertDialog not firing "click" event when canceled
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-04-19T22:36:14.000+0000 |
Affected Version/s | Release 7.1.0 |
Fix Version/s | Release 7.3.0 |
Components | Android |
Labels | alertdialog, andoid, eventlistener, parity |
Reporter | josh.mocek |
Assignee | Joshua Quick |
Created | 2018-04-19T14:31:26.000+0000 |
Updated | 2018-06-19T17:58:42.000+0000 |
Description
The alert dialog doesn't fire a cancel event if you press outside of the alertDialog box in 7.1.0. The event listener actually doesn't console anything if done this way. If you switch it back to 6.2.2 it works correctly and fires the eventlistener when the user touches outside of the alert dialog.
Make a sample AppSellHerHater project and paste the index.js below. Then build to android on 7.1.0 and watch it not work. Then build with 6.2.2 and watch it work correctly.
//Replace the index.js code with this
function doClick(e) {
myAlert.show();
}
$.index.open();
var myAlert = Ti.UI.createAlertDialog({
cancel: 1,
buttonNames: ['Ok', 'Cancel'],
message: "Event listener doesn't fire if you press outside of alert on android...",
title: 'Confirm Ok'
});
myAlert.addEventListener('click', function(e) {
console.info('e.index: ' + e.index);
$.label.text = (e.index == 0) ? "You pressed 'Ok'..." : "You cancelled the alert...";
alert('e.index: ' + e.index);
});
I believe the change for [TIMOB-25919] will resolve this issue as well. That ticket's change is scheduled to be made in Titanium 7.2.0. Stay tuned.
Classic app test code...
Confirmed fixed by [TIMOB-25919]
Just making sure this is also resolved for when the back button is pressed?
Yes. We've confirmed that pressing the back button will fire a "click" event matching the cancel button index as well with the above fix.
Verified the fix with SDK 7.3.0.v20180618182516. Closing.