Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17553] Android: showDatePickerDialog cancel property always false and callback called twice

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid
LabelsAndroid, DatePicker, Picker, TCSupport
ReporterBar Bruy
AssigneeUnknown
Created2014-07-31T11:31:09.000+0000
Updated2018-02-28T20:04:22.000+0000

Description

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.

Comments

  1. Mauro Parra-Miranda 2014-08-26

    Thanks for your report! The Platform team will set the priority on this issue.

JSON Source