Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #385 from gluestack/fix/remove-variant-props
Browse files Browse the repository at this point in the history
fix: remove variant props
  • Loading branch information
ankit-tailor authored Sep 4, 2023
2 parents 6c22083 + e66e278 commit cd79132
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/react/src/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,15 @@ export function getVariantProps(

if (restProps) {
variantTypes?.forEach((variant) => {
if (props.hasOwnProperty(variant)) {
if (
props.hasOwnProperty(variant) &&
theme.variants[variant]?.[props[variant]]
) {
variantProps[variant] = props[variant];
if (shouldDeleteVariants) delete restProps[variant];

if (shouldDeleteVariants) {
delete restProps[variant];
}
}
});
}
Expand Down Expand Up @@ -1119,7 +1125,8 @@ export function verboseStyled<P, Variants, ComCon>(

Object.assign(themeDefaultProps, incomingComponentProps);

const { variantProps } = getVariantProps(themeDefaultProps, theme);
const { variantProps, restProps: componentPropsWithoutVariants } =
getVariantProps(themeDefaultProps, theme);

const {
baseStyleCSSIds: applyBaseStyleCSSIds,
Expand All @@ -1143,7 +1150,7 @@ export function verboseStyled<P, Variants, ComCon>(

const { sx: filteredComponentSx, rest: filteredComponentRemainingProps } =
convertUtiltiyToSXFromProps(
componentProps,
componentPropsWithoutVariants,
styledSystemProps,
componentStyleConfig
);
Expand Down

0 comments on commit cd79132

Please sign in to comment.