fix #190: allow kebab-case names containing more than one '-'

This commit is contained in:
Antonino Porcino 2016-09-05 17:55:49 +02:00 committed by ido
parent 079f5da0d1
commit dd2fbae5ec
1 changed files with 2 additions and 1 deletions

View File

@ -258,8 +258,9 @@ function convertTagNameToConstructor(tagName, context) {
const targetSupport = reactNativeSupport[context.options.nativeTargetVersion];
return _.includes(targetSupport.components, tagName) ? `${targetSupport.reactNative.name}.${tagName}` : tagName;
}
const isHtmlTag = _.includes(reactDOMSupport[context.options.targetVersion], tagName) || isCustomElement(tagName);
let isHtmlTag = _.includes(reactDOMSupport[context.options.targetVersion], tagName) || isCustomElement(tagName);
if (reactSupport.shouldUseCreateElement(context)) {
isHtmlTag = isHtmlTag || tagName.match(/^\w+(-\w+)+$/);
return isHtmlTag ? `'${tagName}'` : tagName;
}
return isHtmlTag ? `React.DOM.${tagName}` : tagName;