[ALOY-1176] Compilation Error when adding a SearchView as a child of MenuItem ActionView
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Resolved |
Resolution | Duplicate |
Resolution Date | 2014-10-22T14:03:08.000+0000 |
Affected Version/s | Alloy 1.6.0 |
Fix Version/s | n/a |
Components | XML |
Labels | n/a |
Reporter | Benjamin Hatfield |
Assignee | Tim Poulsen |
Created | 2014-10-21T21:29:19.000+0000 |
Updated | 2014-10-22T14:03:08.000+0000 |
Description
DESCRIPTION:
Alloy throws a compilation error when declaring a SearchView as a child of MenuItem ActionView in XML markup.
REPRODUCTION:
Run the code below in the Genymotion emulator.
index.xml
:
<Alloy>
<Window id="win">
<Menu>
<MenuItem>
<ActionView>
<SearchView hintText="Type Something"/>
</ActionView>
</MenuItem>
</Menu>
</Window>
</Alloy>
index.js
:
$.win.open();
RESULTS:
Alloy throws a compilation error:
[WARN] : ('You attempted to attach an Android Menu to a lightweight Window');
[WARN] : ('or other UI component which does not have an Android activity.');
[WARN] : ('Android Menus can only be opened on TabGroups and heavyweight Windows.');
[ERROR] :
[ERROR] : (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:189:18)
[ERROR] : (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:197:11)
[ERROR] : (/usr/local/lib/node_modules/alloy/node_modules/uglify-js/lib/parse.js:664:9)
[ERROR] : Alloy compiler failed
[ERROR] Application Installer abnormal process termination. Process exit value was 1
Classic test:
var win = Ti.UI.createWindow();
win.addEventListener("open", function() {
win.activity.onCreateOptionsMenu = function(e) {
var item, menu;
menu = e.menu;
menu.clear();
item = menu.add({
title : "Search",
showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS,
actionView: Ti.UI.Android.createSearchView({ hintText: "Type Somethings" })
});
};
});
win.open();
Oops. Seems to be a namespace issue. Adding the
ns
attribute allows the Alloy compilation process to succeed. I'll open up an improvement ticket instead to have SearchView implicitly namespaced to "Ti.UI.Android" like some of the iOS components.I'm going to close this and fix it via ALOY-1177.