Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/config reference #1490

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.26",
"version": "1.0.27-alpha.4",
"keywords": [
"React Native",
"Next.js",
Expand Down
18 changes: 16 additions & 2 deletions packages/styled/react/src/StyledProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 @@ -57,8 +58,21 @@ export const StyledProvider: React.FC<{
inlineStyleMap.current.initialStyleInjected = false;

const currentConfig: any = React.useMemo(() => {
//TODO: Add this later
return platformSpecificSpaceUnits(config, Platform.OS);
// 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,
Platform.OS
);

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

return configWithPlatformSpecificUnits;
}, [config]);

if (Platform.OS === 'web' && globalStyles) {
Expand Down