diff --git a/lib/index.js b/lib/index.js index 862a6de..24bc22f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -199,17 +199,23 @@ module.exports = function (_ref) { var componentAttrs = {}; var internalInlineStyleAttrs = {}; var indexToBeRemoved = []; - attrs.map(function (attr, ind) { - if (attr.type !== "JSXSpreadAttribute" && ["colorScheme", "variant", "size"].includes(attr.name.name)) { + attrs.forEach(function (attr, ind) { + if (attr.type === "JSXSpreadAttribute" || !attr.value) { + return; + } + + var isNBattr = ["colorScheme", "variant", "size"].includes(attr.name.name) + + if (isNBattr) { componentAttrs[attr.name.name] = attr.value.value; } - if (attr.type !== "JSXSpreadAttribute" && !["colorScheme", "variant", "size"].includes(attr.name.name) && attr.value.type === "StringLiteral") { + if (!isNBattr && attr.value.type === "StringLiteral") { internalInlineStyleAttrs[attr.name.name] = attr.value.value; indexToBeRemoved.push(ind); } - if (attr.type !== "JSXSpreadAttribute" && !["colorScheme", "variant", "size"].includes(attr.name.name) && attr.value.type === "JSXExpressionContainer" && attr.value.expression.type === "NumericLiteral") { + if (!isNBattr && attr.value.type === "JSXExpressionContainer" && attr.value.expression.type === "NumericLiteral") { internalInlineStyleAttrs[attr.name.name] = attr.value.expression.value; indexToBeRemoved.push(ind); } diff --git a/package.json b/package.json index 4220bbd..8f73c3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@native-base/babel-plugin", - "version": "1.0.13", + "version": "1.0.14", "description": "A babel plugin to add Build time theme resolution for Nativebase", "main": "lib/index.js", "scripts": {