diff --git a/src/Layout.js b/src/Layout.js index 99a52cee..4f99754a 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -361,7 +361,7 @@ var computeLayout = (function() { var/*float*/ leadingMainDim = 0; var/*float*/ betweenMainDim = 0; - var/*float*/ definedMainDim = 0; + var/*float*/ definedMainDim = fmaxf(mainContentDim, 0); if (!isUndefined(node.layout[dim[mainAxis]])) { definedMainDim = node.layout[dim[mainAxis]]; } @@ -373,7 +373,7 @@ var computeLayout = (function() { // If there are flexible children in the mix, they are going to fill the // remaining space - if (flexibleChildrenCount != 0) { + if (flexibleChildrenCount !== 0) { var/*float*/ flexibleMainDim = remainingMainDim / totalFlexible; // The non flexible children can overflow the container, in this case diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index bf8b29ac..8893f9b1 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -1055,17 +1055,6 @@ 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} - ]} - ); - }); - it('should layout border bottom inside of justify content space between container', function() { testLayout( {style: {justifyContent: 'space-between'}, children: [ @@ -1077,6 +1066,29 @@ describe('Layout', function() { ); }); + it('should layout negative margin top inside of justify content center container', 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} + ]} + ); + }); + + it('should layout positive margin top inside of justify content center container', function() { + testLayout( + {style: {justifyContent: 'center'}, children: [ + {style: {marginTop: 20}} + ]}, + {width: 0, height: 20, top: 0, left: 0, children: [ + {width: 0, height: 0, top: 20, left: 0} + ]} + ); + }); + + xit('should layout flex-wrap', function() { testLayout( {style: {flexWrap: 'wrap', flexDirection: 'row', width: 100}, children: [