UNPKG

@titanium/turbo

Version:

🚀 Axway Amplify tool to use Turbo for turbo charging your Appcelerator Titanium SDK Framework!

66 lines (54 loc) • 1.71 kB
var styler = require('../styler'), U = require('../../../utils'), CU = require('../compilerUtils'), tiapp = require('../../../tiapp'), logger = require('../../../logger'); var DEPRECATED_VERSION = '3.1.3'; exports.parse = function(node, state) { return require('./base').parse(node, state, parse); }; function parse(node, state, args) { if (tiapp.version.gte(tiapp.getSdkVersion(), DEPRECATED_VERSION)) { logger.warn([ 'Ti.UI.iPhone.NavigationGroup (line ' + node.lineNumber + ') is deprecated as of Titanium ' + DEPRECATED_VERSION, 'Use Ti.UI.NavigationWindow instead' ]); } var children = U.XML.getElementsFromNodes(node.childNodes), err = ['NavigationGroup must have only one child element, which must be a Window'], code = ''; // NavigationGroup must have 1 window as a child if (children.length !== 1) { U.die(err); } var child = children[0], childArgs = CU.getParserArgs(child), theNode = CU.validateNodeName(child, 'Ti.UI.Window'), windowSymbol; // generate the code for the Window first if (theNode) { const generated_code = CU.generateNodeExtended(child, state, { parent: {}, post: function(node, state, args) { windowSymbol = state.parent.symbol; } }); if(typeof generated_code === 'object'){ code += generated_code.content; } else { code += generated_code; } } else { err.unshift('Invalid NavigationGroup child "' + childArgs.fullname + '"'); U.die(err); } // create navgroup with window state.extraStyle = styler.createVariableStyle('window', windowSymbol); code += require('./default').parse(node, state).code; // Update the parsing state return { parent: {}, styles: state.styles, code: code }; }