From f564effb5c25f5310a4f80ed142e720d44aed2ee Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Tue, 22 Apr 2014 09:56:48 -0700 Subject: [PATCH] flex overflow --- src/Layout.js | 3 +++ src/__tests__/Layout-test.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Layout.js b/src/Layout.js index 65929afd..2c009cd8 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -209,6 +209,9 @@ var computeLayout = (function() { if (flexibleChildrenCount) { var/*float*/ flexibleMainDim = remainingMainDim / flexibleChildrenCount; + if (flexibleMainDim < 0) { + flexibleMainDim = 0; + } for (var/*int*/ i = 0; i < node.children.length; ++i) { var/*css_node_t**/ child = node.children[i]; if (getFlex(child)) { diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 7008428b..88235377 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -645,6 +645,22 @@ describe('Layout', function() { ) }); + it('should layout node with flex and overflow', function() { + testLayout( + {style: {height: 300}, children: [ + {style: {height: 600}}, + {style: {flex: 1}} + ]}, + {width: 0, height: 300, top: 0, left: 0, children: [ + {width: 0, height: 600, top: 0, left: 0}, + {width: 0, height: 0, top: 600, left: 0} + ]} + ); + }); + + + + it('should layout randomly', function() { function RNG(seed) { this.state = seed;