[TIMOB-14200] Android: Date Picker and Time Picker change event not firing when value changed by pressing "done" through keyboard
GitHub Issue | n/a |
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2017-06-28T20:10:59.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Priti Srivastava |
Assignee | Eric Merriman |
Created | 2013-06-13T10:43:17.000+0000 |
Updated | 2017-06-28T20:10:59.000+0000 |
Description
While using the keyboard to enter values in picker, and entering some value in last field then tapping done to dismiss the keyboard; the value though visible in the field (year column) but the picker's "value" property does not reflects the same, and therefore selected value (on UI) is not reflected in the field above.
If the user taps on any other field, so that year field loose focus, changed value get registered and is set by the picker in the above text field.
This seems to be a defect at the SDK level. The same problem exists for TimePicker as well for the minute field.
Following is code snippet containing date picker code, same happens with time picker also:
----------------------------------------
var moment = require('alloy/moment');
var win = Ti.UI.createWindow({
exitOnClose : true,
layout : 'vertical',
width : Ti.UI.FILL,
height : Ti.UI.FILL,
backgroundColor:'white'
});
var text = Ti.UI.createTextField({
hintText : 'ENTER YOUR DATE OF BIRTH',
top : 10,
width : Ti.UI.SIZE,
height : 120,
left : 0
});
var picker = Ti.UI.createPicker({
type : Ti.UI.PICKER_TYPE_DATE,
top : 50,
visible : false
});
var button = Ti.UI.createButton({
title : 'Select',
top : 100,
width:Ti.UI.SIZE,
height:Ti.UI.SIZE
})
text.addEventListener('click', function(e) {
picker.visible = true;
})
picker.addEventListener('change', function(e) {
Ti.API.info("User selected date: " + e.value.toLocaleString());
});
button.addEventListener('click', function(e) {
var labelText = moment(picker.value.toString(), 'ddd MMM DD YYYY HH:mm:ss Z').format('MMMM DD, YYYY');
text.value = labelText;
});
win.add(text);
win.add(picker);
win.add(button);
win.open();
----------------------------------------
Screenshots attached display the wrong value selected within the textField
Attachments
I am unable to reproduce this issue with the following environment; Pixel (7.1) Ti SDK 6.1.1.v20170626160851 Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131