[AC-1816] JSS files and require seems to conflict on Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-04-02T23:35:43.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, core, jss |
Reporter | john q hiu |
Assignee | Mauro Parra-Miranda |
Created | 2012-10-24T18:09:01.000+0000 |
Updated | 2016-03-08T07:40:43.000+0000 |
Description
It seems to be a problem with the use of require()
In this example only the styles from jss is applied to the window and not to the label.
*app.js*
{quote}
var NewLabel = require('NewLabel');
var label = new NewLabel();
var win = Ti.UI.createWindow({
id : 'mainwin'
});
win.add(label);
win.open();
*NewLabel.js*
function NewLabel() {
var label = Ti.UI.createLabel({
id : 'ptlabel'
});
return label;
};
module.exports = NewLabel;
*app.jss*
#mainwin {
background-color: '#f00';
}
#ptlabel {
color:'#fff';
top:10;
width:'auto';
height:'auto';
text:'I am Android!'
}
The label in on a different file and the JSS file needs to be called the same as the JS file. Also, JSS was created for when we used the window "url" and it is not mean to be used with CommonJS modules.
Invalid issue.