specific width and stretch should favor the specific width
This commit is contained in:
@@ -267,12 +267,14 @@ var computeLayout = (function() {
|
||||
} else if (alignItem == CSS_ALIGN_FLEX_END) {
|
||||
leadingCrossDim += remainingCrossDim;
|
||||
} else if (alignItem == CSS_ALIGN_STRETCH) {
|
||||
if (!isDimDefined(child, crossAxis)) {
|
||||
child.layout[dim[crossAxis]] = node.layout[dim[crossAxis]] -
|
||||
getPadding(node, leading[crossAxis]) -
|
||||
getPadding(node, trailing[crossAxis]) -
|
||||
getMargin(child, leading[crossAxis]) -
|
||||
getMargin(child, trailing[crossAxis]);
|
||||
}
|
||||
}
|
||||
child.layout[pos[crossAxis]] += leadingCrossDim;
|
||||
}
|
||||
}
|
||||
|
@@ -518,6 +518,23 @@ describe('Layout', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('should layout node with specified width and stretch', function() {
|
||||
testLayout(
|
||||
{style: {}, children: [{
|
||||
style: {}, children: [
|
||||
{style: {width: 400}}
|
||||
]},
|
||||
{style: {width: 200, alignSelf: 'stretch'}}
|
||||
]},
|
||||
{width: 400, height: 0, top: 0, left: 0, children: [
|
||||
{width: 400, height: 0, top: 0, left: 0, children: [
|
||||
{width: 400, height: 0, top: 0, left: 0}
|
||||
]},
|
||||
{width: 200, height: 0, top: 0, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
|
||||
it('should layout randomly', function() {
|
||||
function RNG(seed) {
|
||||
this.state = seed;
|
||||
|
Reference in New Issue
Block a user