From a91915d8d283ec05dc9c7ec0c80d45d105fd2fa2 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 6 Apr 2014 19:21:06 -0700 Subject: [PATCH] flex > height in case of conflict --- spec/LayoutSpec.js | 14 ++++++++++++++ src/Layout.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/LayoutSpec.js b/spec/LayoutSpec.js index b68e6d86..fa4f7d3f 100755 --- a/spec/LayoutSpec.js +++ b/spec/LayoutSpec.js @@ -352,5 +352,19 @@ describe('Layout', function() { }); }); + it('should layout node with flex override height', function() { + testLayout({ + style: {width: 1000, height: 1000}, + children: [ + {style: {width: 100, height: 100, flex: 1}}, + ] + }, { + width: 1000, height: 1000, top: 0, left: 0, + children: [ + {width: 100, height: 1000, top: 0, left: 0} + ] + }); + }); + }); diff --git a/src/Layout.js b/src/Layout.js index 1e45ae02..083812a0 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -80,7 +80,7 @@ function computeLayout(node) { var children = node.children || emptyArray; var mainDimInStyle = dim[mainAxis] in node.style; - if (mainDimInStyle) { + if (node.layout[dim[mainAxis]] === undefined && mainDimInStyle) { node.layout[dim[mainAxis]] = node.style[dim[mainAxis]]; }