Problem Description
On android the datepicker always returns "cancel:false" (if you cancel or accept)
If you press cancel (back button or press outside the modal popup)
the function callback gets called 1time
if you accept the date
the function callback gets called 2 times
Steps to reproduce
- Create a simple project.
- Paste the testcase into app.js
- Run on android tab
Testcase
var win = Ti.UI.createWindow({title:'test'});
win.open();
var picker = Ti.UI.createPicker({value : new Date(),type: Ti.UI.PICKER_TYPE_DATE});
var pickDateButton = Ti.UI.createButton({title:'pick a date'});
win.add(pickDateButton);
pickDateButton.addEventListener('click',function(){
picker.showDatePickerDialog({
value:new Date(),
callback:function(e){
Ti.API.info('picked date: '+JSON.stringify(e));
}
});
});
Workaround
To avoid this bug I ignore the cancel property in the callback, and I check how many times the callback function gets executed.
Thanks for your report! The Platform team will set the priority on this issue.