Skip to content

Commit cbfaf2b

Browse files
authored
Merge pull request #4854 from GeekyAnts/fix/internal-pseudo-prop
fix: internal pseudo prop
2 parents d8e5bf2 + 740c93f commit cbfaf2b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/hooks/useThemeProps/usePropsResolution.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,28 @@ export const usePropsResolutionWithComponentTheme = (
435435
flattenSizeStyle
436436
);
437437

438+
/*Resolve all the internal used Pseudo Props*/
439+
const resolvePseudoProps = (
440+
flatPseudoProp: any /** Props coming from Pseudo inside flattenProps */,
441+
baseStylePseudoProp: any /** Props coming from Pseudo inside defaultStyles(baseStyle) */
442+
) => {
443+
for (const prop in flatPseudoProp) {
444+
baseStylePseudoProp[prop] =
445+
flatPseudoProp[
446+
prop
447+
]; /* Replace all the similar prop from from internal props */
448+
}
449+
return baseStylePseudoProp;
450+
};
451+
438452
for (const prop in defaultStyles) {
453+
if (prop.startsWith('_') && flattenProps.hasOwnProperty(prop)) {
454+
/*Resolve all the internal used Pseudo Props*/
455+
defaultStyles[prop] = resolvePseudoProps(
456+
flattenProps[prop],
457+
defaultStyles[prop]
458+
);
459+
}
439460
delete flattenProps[prop];
440461
}
441462

0 commit comments

Comments
 (0)