since 1.4.x, Alloy has the ability to use a custom query to determine if a style should be applied or not.
See also:
If you want add custom formFactor, follow below steps.
-
add condition styler.js
(/usr/local/lib/node_modules/alloy/Alloy/commands/compile)// line 379 if (q.formFactor === 'tablet') { conditionals.formFactor = 'Alloy.isTablet'; } else if (q.formFactor === 'handheld') { conditionals.formFactor = 'Alloy.isHandheld'; }else if (q.formFactor === 'ios7') { conditionals.formFactor = 'Alloy.isiOS7'; }
-
add condition compilerUtils.js
(/usr/local/lib/node_modules/alloy/Alloy/commands/compile)// line 45 exports.CONDITION_MAP = { handheld: { runtime: "!Alloy.isTablet" }, tablet: { runtime: "Alloy.isTablet" }, ios7 : { runtime: "Alloy.isiOS7" } };
-
add condition alloy.js on your project
Alloy.isiOS7 = Ti.Platform.name == 'iPhone OS' && parseInt(Ti.Platform.version)==7;
on View
<View formFactor="ios7"></View>
on Style
"View[formFactor=ios7]":{
visible : false
}
Definitely something we need to enable without modification of source