[TIMOB-16833] BlackBerry: Ti.UI.createButton has inconsistent results
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-06-12T11:59:47.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | BlackBerry |
| Labels | blackberry, module_button, qe-closed-3.3.0, qe-testadded |
| Reporter | Steven Saracut |
| Assignee | Shak Hossain |
| Created | 2014-04-07T21:31:31.000+0000 |
| Updated | 2014-06-18T11:48:46.000+0000 |
Description
Why does creating 2 buttons inline like this cause the following output:
[INFO] button1 type: [object TiUIButtonProxy]
[INFO] button2 type: function () { [native code] }
// Create a Button.
var button1 = Ti.UI.createButton({
title : 'button1',
height : Ti.UI.SIZE,
width : Ti.UI.SIZE
});
Ti.API.info("button1 type: " + button1);
// Listen for click events.
button1.addEventListener('click', function() {
Ti.API.info('\'button1\' was clicked! : pre-eventListener');
});
// Add to the parent view.
self.mainView.add(button1);
// Create a Button.
var button2 = Ti.UI.createButton({
title : 'button2',
height : Ti.UI.SIZE,
width : Ti.UI.SIZE
});
Ti.API.info("button2 type: " + button2);
// Listen for click events.
button2.addEventListener('click', function() {
Ti.API.info('\'button2\' was clicked! : pre-eventListener');
});
// Add to the parent view.
self.mainView.add(button2);
This is due to the way the V8 objects are created internally. For some reason it fails to add the properties sometimes. I have already found the bug, PR coming soon. This is critical since it is very inconsistent. This code also fails in the current code:
var win = Ti.UI.createWindow(); var btn = Ti.UI.createButton(); btn.addEventListener('click',function(){ var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory); Ti.API.info(file.getDirectoryListing()); }); win.open(); win.add(btn);Pending PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/216
Mauro, it broke after 3.2.2 and I just fixed it. Can you try with Master???? Thanks!
I pulled master and can confirm it worked for me now.
Verified with test environment: Appcelerator-Studio:3.3.0.201406171619 Sdk:3.3.0.v20140617161713 acs:1.0.14 alloy:1.4.0-rc npm:1.3.2 titanium:3.3.0-rc titanium-code-processor:1.1.1 xcode:5.1.1 OS:Maverick(10.9.3) Device:Blackberry Z10 Working as expected. Hence closing the issue