diff --git a/src/utils/propTypeInfo.js b/src/utils/propTypeInfo.js index a95e74876..b58d9f7db 100644 --- a/src/utils/propTypeInfo.js +++ b/src/utils/propTypeInfo.js @@ -62,6 +62,15 @@ export const getDefaultValue = (component, propTypeName) => { return defaultValue; } + if (isEnum(component.propTypes[propTypeName])) { + const staticProperty = toStaticPropertyName(propTypeName); + const property = Object.entries(component[staticProperty]).find( + ([_, value]) => value === defaultValue + )[0]; + + return `${component.name}.${staticProperty}.${property}`; + } + if (typeof defaultValue === 'boolean') { return defaultValue.toString(); } @@ -74,15 +83,6 @@ export const getDefaultValue = (component, propTypeName) => { return undefined; } - if (isEnum(component.propTypes[propTypeName])) { - const staticProperty = toStaticPropertyName(propTypeName); - const property = Object.entries(component[staticProperty]).find( - ([_, value]) => value === defaultValue - )[0]; - - return `${component.name}.${staticProperty}.${property}`; - } - if (typeof defaultValue === 'number') { const specialNumber = findSpecialNumber(defaultValue);