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 #498 from gluestack/fix/props-forwarding-composition
Browse files Browse the repository at this point in the history
Fix/props forwarding composition
  • Loading branch information
ankit-tailor authored Oct 30, 2023
2 parents 0acbcc2 + 15341a6 commit f0c4213
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gluestack-style/react",
"description": "A universal & performant styling library for React Native, Next.js & React",
"version": "1.0.8",
"version": "1.0.9-alpha.6",
"keywords": [
"React Native",
"Next.js",
Expand Down
33 changes: 30 additions & 3 deletions packages/react/src/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,13 @@ const getStyleIdsFromMap = (
styleIds: any
) => {
let componentExtendedConfig = CONFIG;

if (ExtendedConfig) {
componentExtendedConfig = deepMerge(CONFIG, ExtendedConfig);
componentExtendedConfig = deepMergeObjects(CONFIG, ExtendedConfig);
}

Object.assign(styledSystemProps, componentExtendedConfig?.aliases);

const componentStyleIds = styleIds.component;
const componentDescendantStyleIds = styleIds.descendant;

Expand Down Expand Up @@ -1022,6 +1025,7 @@ export function verboseStyled<P, Variants, ComCon>(
const applySxDescendantStyleCSSIdsAndPropsWithKey = useRef({});

const styledContext = useStyled();

const { theme: activeTheme } = useTheme();

const ancestorStyleContext = useContext(AncestorStyleContext);
Expand All @@ -1041,6 +1045,7 @@ export function verboseStyled<P, Variants, ComCon>(
...styledContext.config,
propertyTokenMap,
};

// for extended components

const EXTENDED_THEME =
Expand Down Expand Up @@ -1107,7 +1112,14 @@ export function verboseStyled<P, Variants, ComCon>(
// @ts-ignore
[nonVerbosedTheme, , , Component] = plugins[
pluginName
]?.inputMiddleWare<P>(nonVerbosedTheme, true, true, Component);
]?.inputMiddleWare<P>(
nonVerbosedTheme,
true,
true,
Component,
componentStyleConfig,
ExtendedConfig
);
}
nonVerbosedTheme = convertStyledToStyledVerbosed(nonVerbosedTheme);
}
Expand Down Expand Up @@ -1939,6 +1951,7 @@ export function verboseStyled<P, Variants, ComCon>(
plugins?.length > 0
? {
...variantProps,
states: states,
sx: componentProps.sx,
}
: {};
Expand All @@ -1949,7 +1962,9 @@ export function verboseStyled<P, Variants, ComCon>(
component = (
<ComponentWithPlugin
{...resolvedStyleProps}
{...variantProps}
{...propsToBePassedInToPlugin}
states={states}
style={resolvedStyleMemo}
as={AsComp}
ref={ref}
Expand All @@ -1965,7 +1980,19 @@ export function verboseStyled<P, Variants, ComCon>(
);
}
} else {
component = (
//@ts-ignores
component = Component.isStyledComponent ? (
<ComponentWithPlugin
{...resolvedStyleProps}
{...propsToBePassedInToPlugin}
{...variantProps}
states={states}
style={resolvedStyleMemo}
ref={ref}
>
{children}
</ComponentWithPlugin>
) : (
<ComponentWithPlugin
{...resolvedStyleProps}
{...propsToBePassedInToPlugin}
Expand Down

0 comments on commit f0c4213

Please sign in to comment.