Add support for marginVertical and marginHorizontal

* implement margin as an array of values
* apply margins with the correct priority (e.g. left, horizontal, all)
* update transpiler & tests
This commit is contained in:
Felix Oghină
2014-11-20 17:28:54 +00:00
parent edf0602ae2
commit 6ee0c5817c
6 changed files with 124 additions and 96 deletions

View File

@@ -54,17 +54,22 @@ function __transpileSingleTestToJava(code) {
return 'layout.' + (match1 == 'TOP' ? 'y' : 'x');
})
.replace( // style.position[CSS_TOP] => style.positionTop
/style\.(position|margin|border|padding)\[CSS_(TOP|BOTTOM|LEFT|RIGHT)\]/g,
/style\.(position|border|padding)\[CSS_(TOP|BOTTOM|LEFT|RIGHT)\]/g,
function (str, match1, match2) {
return 'style.' + match1 + match2[0] + match2.substring(1).toLowerCase();
})
.replace( // style.margin[CSS_TOP] => style.margin[CSSStyle.SPACING_TOP]
/style\.(margin)\[CSS_(TOP|BOTTOM|LEFT|RIGHT)\]/g,
function (str, match1, match2) {
return 'style.' + match1 + '[CSSStyle.SPACING_' + match2 + ']';
})
.replace(/get_child\(.*context\,\s([^\)]+)\)/g, 'getChildAt($1)')
.replace(/init_css_node_children/g, 'addChildren')
.replace(/css_node_t(\s)\*/g, 'TestCSSNode$1')
.replace(/\->/g, '.')
.replace(/(\d+\.\d+)/g, '$1f')
.replace( // style.flex_direction => style.flexDirection
/style\.([^_\s]+)_(\w)(\w+)/g,
/style\.([^_\[\]\s]+)_(\w)(\w+)/g,
function (str, match1, match2, match3) {
return 'style.' + match1 + match2.toUpperCase() + match3;
})