From 6a02bff079519d14f24521557b9cf430bbcf6e9d Mon Sep 17 00:00:00 2001 From: Donald Hruska Date: Thu, 20 Dec 2018 11:50:39 -0600 Subject: [PATCH 1/2] Fix combined position properties in generated React Native code --- website/src/components/Playground/CodeReactNative.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/website/src/components/Playground/CodeReactNative.js b/website/src/components/Playground/CodeReactNative.js index d04964cb..16e0b92e 100644 --- a/website/src/components/Playground/CodeReactNative.js +++ b/website/src/components/Playground/CodeReactNative.js @@ -71,18 +71,19 @@ function getLayoutCode(node: LayoutRecordT, indent: string = ''): string { top !== untouchedLayout[key].top && top === left && top === right && - top === bottom + top === bottom && + key !== 'position' ) { // all edges lines.push(indent + ` ${key}: ${node[key].top},`); return; } const alreadySet = []; - if (top && top !== untouchedLayout[key].top && top === bottom) { + if (top && top !== untouchedLayout[key].top && top === bottom && key !== 'position') { lines.push(indent + ` ${key}Vertical: ${getValue(node[key].top)},`); alreadySet.push('top', 'bottom'); } - if (left && left !== untouchedLayout[key].left && left === right) { + if (left && left !== untouchedLayout[key].left && left === right && key !== 'position') { lines.push(indent + ` ${key}Horizontal: ${getValue(node[key].left)},`); alreadySet.push('left', 'right'); } -- 2.50.1.windows.1 From a6741c2556a0aa48f65d9ecc4e6976d34efe9653 Mon Sep 17 00:00:00 2001 From: Donald Hruska Date: Thu, 20 Dec 2018 11:52:07 -0600 Subject: [PATCH 2/2] Fix position keys in generated React Native code --- website/src/components/Playground/CodeReactNative.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/src/components/Playground/CodeReactNative.js b/website/src/components/Playground/CodeReactNative.js index 16e0b92e..aa4da42a 100644 --- a/website/src/components/Playground/CodeReactNative.js +++ b/website/src/components/Playground/CodeReactNative.js @@ -96,9 +96,11 @@ function getLayoutCode(node: LayoutRecordT, indent: string = ''): string { ) { lines.push( indent + - ` ${key}${pKey[0].toUpperCase()}${pKey.substr(1)}: ${getValue( - node[key][pKey], - )},`, + ` ${ + key === "position" + ? pKey + : `${key}${pKey[0].toUpperCase()}${pKey.substr(1)}` + }: ${getValue(node[key][pKey])},` ); } }); -- 2.50.1.windows.1