Skip to content

Commit

Permalink
Merge pull request #1501 from gluestack/release/@gluestack-style/reac…
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit-tailor authored Dec 14, 2023
2 parents 8bd3630 + c1efb3d commit a170962
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
7 changes: 7 additions & 0 deletions packages/styled/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @gluestack-style/react

## 1.0.29

### Patch Changes

- Fixed config reference issue
- Fixed inline resolved stylesheet value

## 1.0.28

### Patch Changes
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.28",
"version": "1.0.29",
"keywords": [
"React Native",
"Next.js",
Expand Down
12 changes: 1 addition & 11 deletions packages/styled/react/src/StyledProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type { COLORMODES } from './types';
import { platformSpecificSpaceUnits } from './utils';
import { createGlobalStylesWeb } from './createGlobalStylesWeb';
import { createGlobalStyles } from './createGlobalStyles';
import { deepClone } from './utils/cssify/utils/common';

type Config = any;
let colorModeSet = false;
Expand Down Expand Up @@ -58,20 +57,11 @@ export const StyledProvider: React.FC<{
inlineStyleMap.current.initialStyleInjected = false;

const currentConfig: any = React.useMemo(() => {
// Removing plugins since its array and deepClone is not working
const plugins = config?.plugins;
delete config?.plugins;

const clonedConfig = deepClone(config);
const configWithPlatformSpecificUnits: any = platformSpecificSpaceUnits(
clonedConfig,
config,
Platform.OS
);

// Re-assign plugins to both the configs
configWithPlatformSpecificUnits.plugins = plugins;
config.plugins = plugins;

return configWithPlatformSpecificUnits;
}, [config]);

Expand Down
4 changes: 3 additions & 1 deletion packages/styled/react/src/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ export function verboseStyled<P, Variants, ComCon>(
INTERNAL_updateCSSStyleInOrderedResolved(
orderedSXResolved,
sxHash,
false,
true,
'gs'
);

Expand Down Expand Up @@ -2055,6 +2055,8 @@ export function verboseStyled<P, Variants, ComCon>(
theme,
componentStyleConfig,
ExtendedConfig,
styleCSSIds,
GluestackStyleSheet,
});

//@ts-ignore
Expand Down
8 changes: 7 additions & 1 deletion packages/styled/react/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export const platformSpecificSpaceUnits = (theme: Config, platform: string) => {
'letterSpacings',
];

const newTheme = { ...theme };
let newTheme = { ...theme };

const isWeb = platform === 'web';
scales.forEach((key) => {
Expand Down Expand Up @@ -372,6 +372,12 @@ export const platformSpecificSpaceUnits = (theme: Config, platform: string) => {
}
}
if (newTheme.tokens) {
newTheme = {
...newTheme,
tokens: {
...newTheme?.tokens,
},
};
//@ts-ignore
newTheme.tokens[key] = newScale;
}
Expand Down

0 comments on commit a170962

Please sign in to comment.