1
0
mirror of https://github.com/bobwen-dev/react-templates synced 2025-04-12 00:56:39 +02:00

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

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;