From bda6b23b8bd5c153c3a3b0a81df4ea1cd94f394a Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Tue, 22 Apr 2014 09:38:17 -0700 Subject: [PATCH] flex and main axis margin --- src/Layout.js | 4 +++- src/__tests__/Layout-test.js | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Layout.js b/src/Layout.js index 1ca26500..1d484685 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -208,7 +208,9 @@ var computeLayout = (function() { for (var/*int*/ i = 0; i < node.children.length; ++i) { var/*css_node_t**/ child = node.children[i]; if (getFlex(child)) { - child.layout[dim[mainAxis]] = flexibleMainDim; + child.layout[dim[mainAxis]] = flexibleMainDim - + getMargin(child, leading[mainAxis]) - + getMargin(child, trailing[mainAxis]); layoutNode(child); } } diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index f34b6361..c58bc3fb 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -606,7 +606,18 @@ describe('Layout', function() { {width: 0, height: 0, top: 100, left: 0} ]} ); - }) + }); + + it('should llll', function() { + testLayout( + {style: {width: 700, flexDirection: 'row'}, children: [ + {style: {marginLeft: 5, flex: 1}} + ]}, + {width: 700, height: 0, top: 0, left: 0, children: [ + {width: 695, height: 0, top: 0, left: 5} + ]} + ); + }); it('should layout randomly', function() { function RNG(seed) {