padding and stretch
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
});
|
||||
|
Reference in New Issue
Block a user