fix bug with negative margin inside of a justifyContent: center container
This commit is contained in:
@@ -362,12 +362,13 @@ var computeLayout = (function() {
|
||||
var/*float*/ leadingMainDim = 0;
|
||||
var/*float*/ betweenMainDim = 0;
|
||||
|
||||
// If the dimensions of the current node is defined by its children, they
|
||||
// are all going to be packed together and we don't need to compute
|
||||
// anything.
|
||||
var/*float*/ definedMainDim = 0;
|
||||
if (!isUndefined(node.layout[dim[mainAxis]])) {
|
||||
definedMainDim = node.layout[dim[mainAxis]];
|
||||
}
|
||||
|
||||
// The remaining available space that needs to be allocated
|
||||
var/*float*/ remainingMainDim = node.layout[dim[mainAxis]] -
|
||||
var/*float*/ remainingMainDim = definedMainDim -
|
||||
getPaddingAndBorderAxis(node, mainAxis) -
|
||||
mainContentDim;
|
||||
|
||||
@@ -430,7 +431,6 @@ var computeLayout = (function() {
|
||||
leadingMainDim = betweenMainDim / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// <Loop C> Position elements in the main axis and compute dimensions
|
||||
|
||||
|
@@ -1055,6 +1055,17 @@ describe('Layout', function() {
|
||||
);
|
||||
});
|
||||
|
||||
it('should layout negative margin top and center justify content', function() {
|
||||
testLayout(
|
||||
{style: {justifyContent: 'center'}, children: [
|
||||
{style: {marginTop: -6}}
|
||||
]},
|
||||
{width: 0, height: 0, top: 0, left: 0, children: [
|
||||
{width: 0, height: 0, top: -3, left: 0}
|
||||
]}
|
||||
);
|
||||
});
|
||||
|
||||
xit('should layout flex-wrap', function() {
|
||||
testLayout(
|
||||
{style: {flexWrap: 'wrap', flexDirection: 'row', width: 100}, children: [
|
||||
|
Reference in New Issue
Block a user