fix bug where nested align: stretch were not properly working

The way the algorithm work is that you first layout fixed children on the main axis, then compute all the dimensions so that you can layout flexible children. This separation doesn't work anymore if we add the other axis. The solution here is a hacky (but working!) attempt at fixing the issue. We start by doing a pass to set the children dimensions if they are stretch.
This commit is contained in:
Christopher Chedeau
2014-05-19 12:39:27 -07:00
parent eae5cdfe68
commit e53bf49746
4 changed files with 101 additions and 1 deletions

View File

@@ -777,7 +777,20 @@ describe('Layout', function() {
)
});
it('should layout node with nested alignSelf: stretch', function() {
testLayout(
{style: {width: 300}, children: [
{style: {alignSelf: 'stretch'}, children: [
{style: {alignSelf: 'stretch'}}
]}
]},
{width: 300, height: 0, top: 0, left: 0, children: [
{width: 300, height: 0, top: 0, left: 0, children: [
{width: 300, height: 0, top: 0, left: 0}
]}
]}
);
});
it('should layout randomly', function() {
function RNG(seed) {