diff --git a/src/Layout.js b/src/Layout.js index 33960242..0663ac9d 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -484,12 +484,19 @@ var computeLayout = (function() { getPosition(child, trailing[mainAxis]); } if (leadingPos && trailingPos) { - child.layout[dim[mainAxis]] = fmaxf(0, - node.layout[dim[mainAxis]] - - child.layout[pos[mainAxis]] - - getMargin(child, trailing[mainAxis]) - - getPosition(child, trailing[mainAxis]) - ) + getPaddingAndBorderAxis(child, mainAxis); + if (isDimDefined(child, mainAxis)) { + child.layout[dim[mainAxis]] = fmaxf( + child.style[dim[mainAxis]], + getPaddingAndBorderAxis(node, mainAxis) + ); + } else { + child.layout[dim[mainAxis]] = fmaxf(0, + node.layout[dim[mainAxis]] - + child.layout[pos[mainAxis]] - + getMargin(child, trailing[mainAxis]) - + getPosition(child, trailing[mainAxis]) + ) + getPaddingAndBorderAxis(child, mainAxis); + } } } } diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 352bb248..9bba5031 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -972,6 +972,17 @@ describe('Layout', function() { ); }); + it('should layout with position absolute top, bottom and height', function() { + testLayout( + {style: {}, children: [ + {style: {top: 5, bottom: 5, height: 900, position: 'absolute'}} + ]}, + {width: 0, height: 0, top: 0, left: 0, children: [ + {width: 0, height: 900, top: 5, left: 0} + ]} + ); + }); + xit('should layout text with alignItems: stretch', function() { testLayout( {style: {width: 80, padding: 7, alignItems: 'stretch', measure: text('loooooooooong with space')}},