Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow using widget as primary control in XML View #949

Merged
merged 6 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Alloy/commands/compile/parsers/Alloy.Require.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,24 @@ function parse(node, state, args) {
type === 'widget' ? 'Alloy.Widget' : 'Alloy.Require',
args.createArgs,
state
) + ');\n';
if (args.parent.symbol && !state.templateObject && !state.androidMenu) {
code += args.symbol + '.setParent(' + args.parent.symbol + ');\n';
) + ')';
let parent = { symbol: args.symbol };
if (args.parent.symbol && !state.templateObject && !state.androidMenu && !state.insideContainer) {
code += ';\n' + args.symbol + '.setParent(' + args.parent.symbol + ');\n';
parent = {
symbol: args.symbol + '.getViewEx({recurse:true})'
};
} else if ( state.insideContainer ) {
code += ';\n';
parent = {
symbol: args.symbol + '.getViewEx({recurse:true})'
};
} else {
code += '.getViewEx({recurse:true});\n';
}

return {
parent: {
symbol: args.symbol + '.getViewEx({recurse:true})'
},
parent: parent,
controller: args.symbol,
styles: state.styles,
code: code
Expand Down
1 change: 1 addition & 0 deletions Alloy/commands/compile/parsers/Ti.UI.Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function parse(node, state, args) {
if (theNode) {
code += CU.generateNodeExtended(child, state, {
parent: {},
insideContainer: true,
post: function(node, state, args) {
windowSymbol = state.parent.symbol;
}
Expand Down