From 5922c88f840d2c96128fdc0ec975e738ba74dbfa Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Tue, 22 Apr 2014 10:21:17 -0700 Subject: [PATCH] double flex and position absolute --- src/Layout.js | 2 +- src/__tests__/Layout-test.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Layout.js b/src/Layout.js index 2297140d..ee108020 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -216,7 +216,7 @@ var computeLayout = (function() { } for (var/*int*/ i = 0; i < node.children.length; ++i) { var/*css_node_t**/ child = node.children[i]; - if (getFlex(child)) { + if (getPositionType(child) === 'relative' && getFlex(child)) { child.layout[dim[mainAxis]] = flexibleMainDim + getPadding(child, leading[mainAxis]) + getPadding(child, trailing[mainAxis]); diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 0d590d59..10905af5 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -669,7 +669,18 @@ describe('Layout', function() { ); }); - + it('should layout node with double flex and position absolute', function() { + testLayout( + {style: {height: 500}, children: [ + {style: {flex: 1}}, + {style: {flex: 1, position: 'absolute'}} + ]}, + {width: 0, height: 500, top: 0, left: 0, children: [ + {width: 0, height: 500, top: 0, left: 0}, + {width: 0, height: 0, top: 500, left: 0}, + ]} + ) + }); it('should layout randomly', function() {