(
};
toBeInjected: any;
styledIds: Array (
styleIds = BUILD_TIME_PARAMS?.verbosedStyleIds;
}
- function injectSx(sx: any, type: any = 'inline') {
+ function injectSx(sx: any, type: any = 'inline', inlineStyleMap?: any) {
const inlineSxTheme = {
baseStyle: sx,
};
@@ -965,7 +966,8 @@ export function verboseStyled (
sxHash,
type,
GluestackStyleSheet,
- Platform.OS
+ Platform.OS,
+ inlineStyleMap
);
return orderedSXResolved;
@@ -996,7 +998,7 @@ export function verboseStyled (
}: Omit<
Omit &
Partial (
const sxCompoundVariantFlatternStyleObject = React.useRef({});
const sxDescendantFlattenStyles: any = React.useRef({});
- const COLOR_MODE: any = get();
+ const COLOR_MODE: any = styledContext._experimentalNestedProvider
+ ? styledContext.colorMode
+ : get();
if (!styleHashCreated) {
CONFIG = {
@@ -1049,6 +1053,8 @@ export function verboseStyled (
if (EXTENDED_THEME) {
// RUN Middlewares
+ nonVerbosedTheme = deepMerge(nonVerbosedTheme, EXTENDED_THEME.theme);
+
const resolvedComponentExtendedTheme = resolveComponentTheme(
CONFIG,
EXTENDED_THEME
@@ -1057,7 +1063,6 @@ export function verboseStyled (
// const resolvedComponentExtendedTheme = EXTENDED_THEME;
theme = deepMerge(theme, resolvedComponentExtendedTheme.theme);
-
// @ts-ignore
Object.assign(themeDefaultProps, theme?.baseStyle?.props);
if (Object.keys(EXTENDED_THEME?.BUILD_TIME_PARAMS ?? {}).length > 0) {
@@ -1068,7 +1073,8 @@ export function verboseStyled (
EXTENDED_THEME_BUILD_TIME_PARAMS?.verbosedStyleIds
);
GluestackStyleSheet.inject(
- EXTENDED_THEME_BUILD_TIME_PARAMS?.toBeInjected
+ EXTENDED_THEME_BUILD_TIME_PARAMS?.toBeInjected,
+ styledContext.inlineStyleMap
);
} else {
// Merge of Extended Config Style ID's with Component Style ID's
@@ -1082,7 +1088,10 @@ export function verboseStyled (
CONFIG,
componentExtendedConfig
);
- GluestackStyleSheet.inject(extendedStylesToBeInjected);
+ GluestackStyleSheet.inject(
+ extendedStylesToBeInjected,
+ styledContext.inlineStyleMap
+ );
}
}
@@ -1096,13 +1105,11 @@ export function verboseStyled (
if (plugins) {
for (const pluginName in plugins) {
// @ts-ignore
- [theme, , , Component] = plugins[pluginName]?.inputMiddleWare (
- theme,
- true,
- true,
- Component
- );
+ [nonVerbosedTheme, , , Component] = plugins[
+ pluginName
+ ]?.inputMiddleWare (nonVerbosedTheme, true, true, Component);
}
+ nonVerbosedTheme = convertStyledToStyledVerbosed(nonVerbosedTheme);
}
// for extended components end
@@ -1131,12 +1138,18 @@ export function verboseStyled (
componentExtendedConfig
);
if (Platform.OS === 'web') {
- GluestackStyleSheet.inject(toBeInjected);
+ GluestackStyleSheet.inject(
+ toBeInjected,
+ styledContext.inlineStyleMap
+ );
}
} else {
if (Platform.OS === 'web') {
//@ts-ignore
- GluestackStyleSheet.inject(BUILD_TIME_PARAMS.toBeInjected);
+ GluestackStyleSheet.inject(
+ BUILD_TIME_PARAMS.toBeInjected,
+ styledContext.inlineStyleMap
+ );
}
}
@@ -1185,7 +1198,7 @@ export function verboseStyled (
const {
variantProps: defaultVariantProps,
- restProps: defaultComponentPropsWithoutVariants,
+ restProps: defaultThemePropsWithoutVariants,
} = getVariantProps(themeDefaultProps, theme);
const {
@@ -1227,7 +1240,10 @@ export function verboseStyled (
);
if (Platform.OS === 'web') {
- GluestackStyleSheet.inject(toBeInjected);
+ GluestackStyleSheet.inject(
+ toBeInjected,
+ styledContext.inlineStyleMap
+ );
}
isInjected = true;
}
@@ -1368,7 +1384,7 @@ export function verboseStyled (
const defaultResolvedInlineProps = resolveInlineProps(
componentStyleConfig,
componentExtendedConfig,
- defaultComponentPropsWithoutVariants,
+ defaultThemePropsWithoutVariants,
CONFIG
);
@@ -1388,17 +1404,19 @@ export function verboseStyled (
const { sx: filteredComponentSx, rest: filteredComponentRemainingProps } =
convertUtiltiyToSXFromProps(
- Object.assign(
- defaultComponentPropsWithoutVariants,
- inlineComponentPropsWithoutVariants
- ),
+ // Object.assign(
+ // defaultThemePropsWithoutVariants,
+ inlineComponentPropsWithoutVariants,
styledSystemProps,
componentStyleConfig
);
let { sx: filteredPassingSx, rest: filteredPassingRemainingProps } =
convertUtiltiyToSXFromProps(
- shallowMerge({ ...passingProps }, applyAncestorPassingProps),
+ shallowMerge(
+ { ...defaultThemePropsWithoutVariants, ...passingProps },
+ applyAncestorPassingProps
+ ),
styledSystemProps,
componentStyleConfig
);
@@ -1430,11 +1448,19 @@ export function verboseStyled (
function injectAndUpdateSXProps(filteredPassingSx: any) {
if (Object.keys(filteredComponentSx).length > 0) {
- orderedComponentSXResolved = injectSx(filteredComponentSx, 'inline');
+ orderedComponentSXResolved = injectSx(
+ filteredComponentSx,
+ 'inline',
+ styledContext.inlineStyleMap
+ );
}
if (Object.keys(filteredPassingSx).length > 0) {
- orderedPassingSXResolved = injectSx(filteredPassingSx, 'passing');
+ orderedPassingSXResolved = injectSx(
+ filteredPassingSx,
+ 'passing',
+ styledContext.inlineStyleMap
+ );
}
const orderedSXResolved = [
@@ -1886,40 +1912,50 @@ export function verboseStyled (
// }
- if (plugins) {
- // plugins?.reverse();
- plugins.reverse();
- for (const pluginName in plugins) {
- // @ts-ignore
- if (plugins[pluginName]?.componentMiddleWare) {
+ const ComponentWithPlugin = React.useMemo(() => {
+ if (plugins) {
+ for (const pluginName in plugins) {
// @ts-ignore
- Component = plugins[pluginName]?.componentMiddleWare({
- Component: Component,
- theme,
- componentStyleConfig,
- ExtendedConfig,
- });
+ if (plugins[pluginName]?.componentMiddleWare) {
+ // @ts-ignore
+ Component = plugins[pluginName]?.componentMiddleWare({
+ Component: Component,
+ theme,
+ componentStyleConfig,
+ ExtendedConfig,
+ });
- //@ts-ignore
- pluginData = Component.styled;
+ //@ts-ignore
+ pluginData = { ...pluginData, ...Component?.styled };
+ }
}
}
- }
+ return Component;
+ }, []);
let component;
+ const propsToBePassedInToPlugin =
+ plugins?.length > 0
+ ? {
+ ...variantProps,
+ sx: componentProps.sx,
+ }
+ : {};
+
if (AsComp) {
//@ts-ignore
if (Component.isStyledComponent) {
component = (
- (
}
} else {
component = (
- (
styledIds: Array (
sxConvertedObject,
componentStyleConfig,
ExtendedConfig,
- BUILD_TIME_PARAMS
+ BUILD_TIME_PARAMS,
+ nonVerbosedTheme
);
// @ts-ignore
diff --git a/packages/react/src/types.ts b/packages/react/src/types.ts
index 47301963f..019753f30 100644
--- a/packages/react/src/types.ts
+++ b/packages/react/src/types.ts
@@ -65,6 +65,7 @@ export interface Tokens {
breakpoints?: { [key: GenericKey]: Record