From e2e49caf86dc008eb6f7bf876f82e742e51d9cec Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 6 Apr 2014 21:49:09 -0700 Subject: [PATCH] getFlexDirection function --- src/Layout.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Layout.js b/src/Layout.js index 1cc481aa..7836757a 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -59,6 +59,13 @@ function computeLayout(node) { return 'flex-start'; } + function getFlexDirection(node) { + if ('flexDirection' in node.style) { + return node.style.flexDirection; + } + return 'column'; + } + var axis = { left: 'horizontal', right: 'horizontal', @@ -85,7 +92,7 @@ function computeLayout(node) { var emptyArray = []; function layoutNode(node) { - var mainAxis = node.style.flexDirection === 'row' ? 'row' : 'column'; + var mainAxis = getFlexDirection(node); var crossAxis = mainAxis === 'row' ? 'column' : 'row'; var children = node.children || emptyArray;