From ba873aa3d79661f60dbb8424aeb345fa6c44e7d2 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Thu, 11 Dec 2014 14:42:31 +0000 Subject: [PATCH] fix layout border bottom and flex end with an empty child --- src/Layout.js | 8 +++----- src/__tests__/Layout-test.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Layout.js b/src/Layout.js index 4f99754a..ed75ed5a 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -363,13 +363,11 @@ var computeLayout = (function() { var/*float*/ definedMainDim = fmaxf(mainContentDim, 0); if (!isUndefined(node.layout[dim[mainAxis]])) { - definedMainDim = node.layout[dim[mainAxis]]; + definedMainDim = node.layout[dim[mainAxis]] - + getPaddingAndBorderAxis(node, mainAxis); } - // The remaining available space that needs to be allocated - var/*float*/ remainingMainDim = definedMainDim - - getPaddingAndBorderAxis(node, mainAxis) - - mainContentDim; + var/*float*/ remainingMainDim = definedMainDim - mainContentDim; // If there are flexible children in the mix, they are going to fill the // remaining space diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 8893f9b1..ee854146 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -1088,6 +1088,16 @@ describe('Layout', function() { ); }); + it('should layout border bottom and flex end with an empty child', function() { + testLayout( + {style: {borderBottomWidth: 5, justifyContent: 'flex-end'}, children: [ + {style: {}} + ]}, + {width: 0, height: 5, top: 0, left: 0, children: [ + {width: 0, height: 0, top: 0, left: 0} + ]} + ); + }); xit('should layout flex-wrap', function() { testLayout(