specific width and stretch should favor the specific width
This commit is contained in:
@@ -267,11 +267,13 @@ var computeLayout = (function() {
|
|||||||
} else if (alignItem == CSS_ALIGN_FLEX_END) {
|
} else if (alignItem == CSS_ALIGN_FLEX_END) {
|
||||||
leadingCrossDim += remainingCrossDim;
|
leadingCrossDim += remainingCrossDim;
|
||||||
} else if (alignItem == CSS_ALIGN_STRETCH) {
|
} else if (alignItem == CSS_ALIGN_STRETCH) {
|
||||||
child.layout[dim[crossAxis]] = node.layout[dim[crossAxis]] -
|
if (!isDimDefined(child, crossAxis)) {
|
||||||
getPadding(node, leading[crossAxis]) -
|
child.layout[dim[crossAxis]] = node.layout[dim[crossAxis]] -
|
||||||
getPadding(node, trailing[crossAxis]) -
|
getPadding(node, leading[crossAxis]) -
|
||||||
getMargin(child, leading[crossAxis]) -
|
getPadding(node, trailing[crossAxis]) -
|
||||||
getMargin(child, trailing[crossAxis]);
|
getMargin(child, leading[crossAxis]) -
|
||||||
|
getMargin(child, trailing[crossAxis]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
child.layout[pos[crossAxis]] += leadingCrossDim;
|
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() {
|
it('should layout randomly', function() {
|
||||||
function RNG(seed) {
|
function RNG(seed) {
|
||||||
this.state = seed;
|
this.state = seed;
|
||||||
|
Reference in New Issue
Block a user