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 #381 from gluestack/fix/mediaquery-sepcificity
Browse files Browse the repository at this point in the history
Fix/mediaquery sepcificity
  • Loading branch information
ankit-tailor authored Sep 1, 2023
2 parents eb17e9a + 0ebda2f commit 5272a1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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": "0.2.20",
"version": "0.2.21",
"keywords": [
"React Native",
"Next.js",
Expand Down
5 changes: 3 additions & 2 deletions packages/react/src/utils/cssify/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,14 @@ const createCssRule = (
const colorModeRulePrefix = prefixColorMode
? `.${prefixColorMode}${colorMode}`
: '';
const mediaQueryPrefix = `.gs`;

const inlineAndStatePrefix = `${inlineRulePrefix}${stateRulePrefix}`;

if (isMedia(mediaQuery) && isColorScheme(colorSchemeQuery)) {
return `${mediaQuery} {${inlineAndStatePrefix}${colorModeRulePrefix} ${dataMediaSelector} ${css}}`;
return `${mediaQuery} {${mediaQueryPrefix}${inlineAndStatePrefix}${colorModeRulePrefix} ${dataMediaSelector} ${css}}`;
} else if (isMedia(mediaQuery)) {
return `${mediaQuery} {${inlineAndStatePrefix} ${dataMediaSelector} ${css}}`;
return `${mediaQuery} {${mediaQueryPrefix}${inlineAndStatePrefix} ${dataMediaSelector} ${css}}`;
} else if (isColorScheme(colorSchemeQuery)) {
return `${inlineAndStatePrefix}${colorModeRulePrefix} ${dataMediaSelector} ${css}`;
} else {
Expand Down

0 comments on commit 5272a1e

Please sign in to comment.