From 8f03c5f1255f05d46d71394d1193fc32fa95be11 Mon Sep 17 00:00:00 2001 From: Suraj Date: Wed, 10 Jan 2024 18:17:04 +0530 Subject: [PATCH 1/2] fix: config resolution in StyledProvider --- packages/styled/react/src/StyledProvider.tsx | 7 ++++++- packages/styled/react/src/createConfig.ts | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/styled/react/src/StyledProvider.tsx b/packages/styled/react/src/StyledProvider.tsx index ec4d689baa..37689a65e7 100644 --- a/packages/styled/react/src/StyledProvider.tsx +++ b/packages/styled/react/src/StyledProvider.tsx @@ -12,6 +12,7 @@ import { createGlobalStyles } from './createGlobalStyles'; import { injectGlobalCssStyle } from './injectInStyle'; import { ThemeContext, useTheme } from './Theme'; import { useSafeLayoutEffect } from './hooks/useSafeLayoutEffect'; +import { resolveThemes } from './createConfig'; type Config = any; let colorModeSet = false; @@ -75,7 +76,7 @@ export const StyledProvider: React.FC<{ inlineStyleMap.current.initialStyleInjected = false; // const id = React.useId(); const currentConfig: any = React.useMemo(() => { - const configWithPlatformSpecificUnits: any = platformSpecificSpaceUnits( + let configWithPlatformSpecificUnits: any = platformSpecificSpaceUnits( config, Platform.OS ); @@ -89,6 +90,10 @@ export const StyledProvider: React.FC<{ Platform.OS ).tokens; }); + + configWithPlatformSpecificUnits = resolveThemes( + configWithPlatformSpecificUnits + ); } return configWithPlatformSpecificUnits; diff --git a/packages/styled/react/src/createConfig.ts b/packages/styled/react/src/createConfig.ts index 970922f097..0aa1e18560 100644 --- a/packages/styled/react/src/createConfig.ts +++ b/packages/styled/react/src/createConfig.ts @@ -85,14 +85,14 @@ export const createConfig = < // newConfig = resolveComponentThemes(config); // } - if (config.themes) { - const newConfigWithThemesResolved = resolveThemes(config); - return newConfigWithThemesResolved as any; - } + // if (config.themes) { + // const newConfigWithThemesResolved = resolveThemes(config); + // return newConfigWithThemesResolved as any; + // } return config as any; }; -const resolveThemes = (config: any) => { +export const resolveThemes = (config: any) => { function removeDollarSign(obj: any) { const newObj: any = {}; for (const key in obj) { From 1da47c064f62c7275132793fae2f80eb70e49180 Mon Sep 17 00:00:00 2001 From: Suraj Date: Wed, 10 Jan 2024 18:18:37 +0530 Subject: [PATCH 2/2] chore: version updated --- packages/styled/react/CHANGELOG.md | 6 ++++++ packages/styled/react/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/styled/react/CHANGELOG.md b/packages/styled/react/CHANGELOG.md index 5440276e51..1649eb4d83 100644 --- a/packages/styled/react/CHANGELOG.md +++ b/packages/styled/react/CHANGELOG.md @@ -1,5 +1,11 @@ # @gluestack-style/react +## 1.0.33 + +### Patch Changes + +- - Theme token resolution inside StyledProvider + ## 1.0.32 ### Features diff --git a/packages/styled/react/package.json b/packages/styled/react/package.json index b413d6493c..456f6709bd 100644 --- a/packages/styled/react/package.json +++ b/packages/styled/react/package.json @@ -1,7 +1,7 @@ { "name": "@gluestack-style/react", "description": "A universal & performant styling library for React Native, Next.js & React", - "version": "1.0.32", + "version": "1.0.33", "keywords": [ "React Native", "Next.js",