diff --git a/spec/LayoutSpec.js b/spec/LayoutSpec.js index dc99bc17..3520d81e 100755 --- a/spec/LayoutSpec.js +++ b/spec/LayoutSpec.js @@ -501,6 +501,17 @@ describe('Layout', function() { ); }); + it('should layout node with padding and stretch', function() { + testLayout( + {style: {}, children: [ + {style: {padding: 10, alignSelf: 'stretch'}} + ]}, + {width: 20, height: 20, top: 0, left: 0, children: [ + {width: 20, height: 20, top: 0, left: 0} + ]} + ); + }); + it('should layout randomly', function() { function RNG(seed) { this.state = seed; diff --git a/src/Layout.js b/src/Layout.js index 5eb3025a..ea821b33 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -204,7 +204,9 @@ function computeLayout(node) { } else if (alignItem === 'stretch') { child.layout[dim[crossAxis]] += node.layout[dim[crossAxis]] - getMargin(child, leading[crossAxis]) - - getMargin(child, trailing[crossAxis]); + getMargin(child, trailing[crossAxis]) - + getPadding(child, leading[crossAxis]) - + getPadding(child, trailing[crossAxis]); } child.layout[pos[crossAxis]] += leadingCrossDim; });