Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

"touchstart" and "touchend" events not firing on UI.Pickers containing any PickerRows.

$
0
0

When a UI.Picker element has any rows/columns contained within it, the "touchstart" and "touchend" events completely cease to fire. Here's some example code showcasing the problem:

Events work fine with an empty UI.Picker:

function FirstView() {
    Ti.API.info("Testing touchstart and touchend events on a picker.")
 
    var self = Ti.UI.createView();
 
    var picker = Ti.UI.createPicker();
 
    picker.selectionIndicator = true;
 
    self.add(picker);
 
    picker.addEventListener("touchstart", function() {
        Ti.API.info("TOUCH START");
    });
    picker.addEventListener("touchend", function() {
        Ti.API.info("TOUCH END");
    });
 
    return self;
}
 
module.exports = FirstView;

Output:
[INFO] :   Testing touchstart and touchend events on a picker.
[INFO] :   TOUCH START
[INFO] :   TOUCH END
[INFO] :   TOUCH START
[INFO] :   TOUCH END
[INFO] :   TOUCH START
[INFO] :   TOUCH END

Events no longer fire when rows are added:

function FirstView() {
    Ti.API.info("Testing touchstart and touchend events on a picker.")
 
    var self = Ti.UI.createView();
 
    var picker = Ti.UI.createPicker();
 
    var data = [];
    data[0] = Ti.UI.createPickerRow({title:'programming'});
    data[1] = Ti.UI.createPickerRow({title:'is'});
    data[2] = Ti.UI.createPickerRow({title:'cool'});
    picker.add(data);
 
    picker.selectionIndicator = true;
 
    self.add(picker);
 
    picker.addEventListener("touchstart", function() {
        Ti.API.info("TOUCH START");
    });
    picker.addEventListener("touchend", function() {
        Ti.API.info("TOUCH END");
    });
 
    return self;
}
 
module.exports = FirstView;

Output:

[INFO] : Testing touchstart and touchend events on a picker.

Relevant information:

  • Titanium SDK 3.5.0.GA
  • iOS Simulator (iPhone 6)
  • Titanium Studio, build: 3.4.1.201410281727

Viewing all articles
Browse latest Browse all 8068

Trending Articles