diff --git a/spec/LayoutSpec.js b/spec/LayoutSpec.js index 3520d81e..dc01bb65 100755 --- a/spec/LayoutSpec.js +++ b/spec/LayoutSpec.js @@ -512,6 +512,18 @@ describe('Layout', function() { ); }); + + it('should layout node with inner & outer padding and stretch', function() { + testLayout( + {style: {padding: 50}, children: [ + {style: {padding: 10, alignSelf: 'stretch'}} + ]}, + {width: 120, height: 120, top: 0, left: 0, children: [ + {width: 20, height: 20, top: 50, left: 50} + ]} + ); + }); + it('should layout randomly', function() { function RNG(seed) { this.state = seed; diff --git a/src/Layout.js b/src/Layout.js index ea821b33..70268f5e 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -203,6 +203,8 @@ function computeLayout(node) { leadingCrossDim += remainingCrossDim; } else if (alignItem === 'stretch') { child.layout[dim[crossAxis]] += node.layout[dim[crossAxis]] - + getPadding(node, leading[crossAxis]) - + getPadding(node, trailing[crossAxis]) - getMargin(child, leading[crossAxis]) - getMargin(child, trailing[crossAxis]) - getPadding(child, leading[crossAxis]) -