Fix combined position properties in generated React Native code

This commit is contained in:
Donald Hruska
2018-12-20 11:50:39 -06:00
parent 56e133ab4c
commit 6a02bff079

View File

@@ -71,18 +71,19 @@ function getLayoutCode(node: LayoutRecordT, indent: string = ''): string {
top !== untouchedLayout[key].top && top !== untouchedLayout[key].top &&
top === left && top === left &&
top === right && top === right &&
top === bottom top === bottom &&
key !== 'position'
) { ) {
// all edges // all edges
lines.push(indent + ` ${key}: ${node[key].top},`); lines.push(indent + ` ${key}: ${node[key].top},`);
return; return;
} }
const alreadySet = []; 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)},`); lines.push(indent + ` ${key}Vertical: ${getValue(node[key].top)},`);
alreadySet.push('top', 'bottom'); 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)},`); lines.push(indent + ` ${key}Horizontal: ${getValue(node[key].left)},`);
alreadySet.push('left', 'right'); alreadySet.push('left', 'right');
} }