diff --git a/src/Layout.js b/src/Layout.js index 5b0c6686..051b6efb 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -475,7 +475,7 @@ var computeLayout = (function() { // In case the child is absolutely positionned and has a // top/left/bottom/right being set, we override all the previously // computed positions to set it correctly. - if (leadingPos && !trailingPos) { + if (leadingPos) { child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) + getBorder(node, leading[crossAxis]) + @@ -488,6 +488,12 @@ var computeLayout = (function() { getMargin(child, trailing[crossAxis]) - getPosition(child, trailing[crossAxis]); } + if (leadingPos && trailingPos) { + child.layout[dim[crossAxis]] = + node.layout[dim[crossAxis]] - + getMargin(child, trailing[crossAxis]) - + getPosition(child, trailing[crossAxis]); + } } else { var/*float*/ leadingCrossDim = getPaddingAndBorder(node, leading[crossAxis]); diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 26db616c..640c2ddc 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -928,6 +928,17 @@ describe('Layout', function() { ); }); + it('should layout with position absolute left and right', function() { + testLayout( + {style: {width: 100}, children: [ + {style: {right: 5, left: 5, position: 'absolute'}} + ]}, + {width: 0, height: 0, top: 0, left: 0, children: [ + {width: 5, height: 0, top: 0, left: -20} + ]} + ); + }); + xit('should layout text with alignItems: stretch', function() { testLayout( {style: {width: 80, padding: 7, alignItems: 'stretch', measure: text('loooooooooong with space')}},