Skip to content

Commit

Permalink
Merge pull request #1596 from gluestack/release/@gluestack-style/reac…
Browse files Browse the repository at this point in the history
  • Loading branch information
surajahmed authored Jan 10, 2024
2 parents 0911f0b + 1da47c0 commit 07f174a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
6 changes: 6 additions & 0 deletions packages/styled/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @gluestack-style/react

## 1.0.33

### Patch Changes

- - Theme token resolution inside StyledProvider

## 1.0.32

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/styled/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.32",
"version": "1.0.33",
"keywords": [
"React Native",
"Next.js",
Expand Down
7 changes: 6 additions & 1 deletion packages/styled/react/src/StyledProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
);
Expand All @@ -89,6 +90,10 @@ export const StyledProvider: React.FC<{
Platform.OS
).tokens;
});

configWithPlatformSpecificUnits = resolveThemes(
configWithPlatformSpecificUnits
);
}

return configWithPlatformSpecificUnits;
Expand Down
10 changes: 5 additions & 5 deletions packages/styled/react/src/createConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 07f174a

Please sign in to comment.