Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #492 from gluestack/release/@gluestack-style/react…
Browse files Browse the repository at this point in the history
…@1.0.8

Release/@gluestack style/[email protected]
  • Loading branch information
ankit-tailor authored Oct 19, 2023
2 parents 47da14e + 1dabe51 commit 1e0c206
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 35 deletions.
2 changes: 1 addition & 1 deletion example/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@expo/html-elements": "^0.4.2",
"@gluestack-style/react": "1.0.7",
"@gluestack-style/react": "1.0.8",
"@gluestack-ui/actionsheet": "^0.2.16",
"@gluestack-ui/alert-dialog": "^0.1.14",
"@gluestack-ui/button": "^0.1.23",
Expand Down
2 changes: 1 addition & 1 deletion packages/benchmark-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"devDependencies": {
"@gluestack-style/babel-plugin-styled-resolver": "1.0.0",
"@gluestack-style/react": "1.0.7",
"@gluestack-style/react": "1.0.8",
"@emotion/styled": "^11.3.0",
"@expo/next-adapter": "^4.0.13",
"@types/react": "17.0.1",
Expand Down
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @gluestack-style/react

## 1.0.8

### Patch Changes

- - Fixed global style platform based resolution
- Fixed useToken to return default value as fallback
- Fixed theme passing props resolution

## 1.0.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/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.7",
"version": "1.0.8",
"keywords": [
"React Native",
"Next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/StyledProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const StyledProvider: React.FC<{

const [animationDriverData, setAnimationDriverData] = React.useState();
const globalStyleMap =
config?.globalStyle && createGlobalStyles(config.globalStyle);
config?.globalStyle && createGlobalStyles(config.globalStyle, Platform);

const contextValue = React.useMemo(() => {
const styledData = {
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/createGlobalStyles.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { convertStyledToStyledVerbosed } from './convertSxToSxVerbosed';
import { stableHash } from './stableHash';
import { resolvePlatformTheme } from './styled';
import { updateOrderUnResolvedMap } from './updateOrderUnResolvedMap';

export const createGlobalStyles = (globalStyle: object) => {
export const createGlobalStyles = (globalStyle: object, Platform) => {
const versboseComponentTheme = convertStyledToStyledVerbosed(globalStyle);
resolvePlatformTheme(versboseComponentTheme, Platform.OS);
const componentHash = stableHash({
...globalStyle,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export const useToken = (tokenScale: string, token: string) => {
const theme: ICustomConfig = useStyled();
// @ts-ignore
const themeTokens = theme.config.tokens;
return themeTokens?.[`${tokenScale}`]?.[`${token}`];
return themeTokens?.[`${tokenScale}`]?.[`${token}`] ?? token;
};
16 changes: 9 additions & 7 deletions packages/react/src/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ export function verboseStyled<P, Variants, ComCon>(

const {
variantProps: defaultVariantProps,
restProps: defaultComponentPropsWithoutVariants,
restProps: defaultThemePropsWithoutVariants,
} = getVariantProps(themeDefaultProps, theme);

const {
Expand Down Expand Up @@ -1384,7 +1384,7 @@ export function verboseStyled<P, Variants, ComCon>(
const defaultResolvedInlineProps = resolveInlineProps(
componentStyleConfig,
componentExtendedConfig,
defaultComponentPropsWithoutVariants,
defaultThemePropsWithoutVariants,
CONFIG
);

Expand All @@ -1404,17 +1404,19 @@ export function verboseStyled<P, Variants, ComCon>(

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
);
Expand Down
23 changes: 1 addition & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2606,28 +2606,7 @@
"@babel/traverse" "^7.20.5"
lodash.merge "^4.6.2"

"@gluestack-style/babel-plugin-styled-resolver@^0.1.6":
version "0.1.14"
resolved "https://registry.yarnpkg.com/@gluestack-style/babel-plugin-styled-resolver/-/babel-plugin-styled-resolver-0.1.14.tgz#1e3cd2dbdf91b5e9dcb8d34ab7df7aed1beea9bb"
integrity sha512-fgfuvCTngRZIbZf5prtoiZeOBaMtjEh4EJUIJygHY6iXscFuU6tnstnMnHqZdCd1dty+2E1DuwnG+JSKfYgYmA==
dependencies:
"@babel/core" "^7.20.5"
"@babel/generator" "^7.20.5"
"@babel/parser" "^7.20.5"
"@babel/plugin-transform-typescript" "^7.20.2"
"@babel/preset-typescript" "^7.18.6"
"@babel/traverse" "^7.20.5"
lodash.merge "^4.6.2"

"@gluestack-style/react@^0.1.33":
version "0.1.33"
resolved "https://registry.yarnpkg.com/@gluestack-style/react/-/react-0.1.33.tgz#cd18f38bf359527e4f79d223bb07e9024f40ba4f"
integrity sha512-wBdoOA3i/cp0EcgJnwJgL1a8BATjbX/pCZgWm31N6sZOgCB4Phq7m0bDjfSpeJ8sKpOEDlUP5wYCo7Yww0mbqA==
dependencies:
inline-style-prefixer "^6.0.1"
normalize-css-color "^1.0.2"

"@gluestack-style/react@^0.2.11-alpha.0", "@gluestack-style/react@^0.2.16", "@gluestack-style/react@^0.2.21", "@gluestack-style/react@^0.2.49":
"@gluestack-style/react@^0.2.16", "@gluestack-style/react@^0.2.21":
version "0.2.51"
resolved "https://registry.yarnpkg.com/@gluestack-style/react/-/react-0.2.51.tgz#0cfcca4f97f908ed3a352bd7e2336d436cc22415"
integrity sha512-21TLr+e7KneP8N1d1iMKG6npMdYb/oPN/t5KZ/2kns2mg9NVCrfVmVuuMYKo+Xcej95BFOHuGuomskzLwdK1HQ==
Expand Down

0 comments on commit 1e0c206

Please sign in to comment.