gluestack / gluestack-ui

React & React Native Components & Patterns (import from library & copy-paste styles all the way to victory)
https://gluestack.io/
MIT License
1.8k stars 88 forks source link

custom mediaQueries on a extracted gluestack-style config generates a `does not exist in type` error #2229

Open JDMetal opened 3 weeks ago

JDMetal commented 3 weeks ago

Description

new breakpoints in the config file not able to resolve when styling components

CodeSandbox/Snack link

https://codesandbox.io/p/sandbox/fragrant-platform-z3mm9j?file=%2Fsrc%2FApp.tsx%3A18%2C13

Steps to reproduce

  1. Extract gluestack theme (gluestack-style.config.ts)
  2. use createConfig and extend from @gluestack-ui/config config with your own custom config
  3. add custom mediaQueries in tokens
  4. use the custom mediaQuery on any component using the gluestack provider with the exctracted theme

gluestack-ui Version

latest

Platform

Other Platform

No response

Additional Information

gluestack-style.config.ts

import {config} from '@gluestack-ui/config';
import {createConfig} from '@gluestack-ui/themed';

export const customConfig = createConfig({
  ...config,
  tokens: {
    mediaQueries: {
      base: '@media screen and (min-width: 0)',
      customBreakpoint: '@media screen and (min-width: 300)',
      sm: '@media screen and (min-width: 600px)',
      md: '@media screen and (min-width: 905px)',
      lg: '@media screen and (min-width: 1240px)',
      xl: '@media screen and (min-width: 1440px)',
    }
  },
} as const);

type Config = typeof customConfig;

declare module '@gluestack-style/react' {
  interface ICustomConfig extends Config {}
}

example component: image

JDMetal commented 3 weeks ago

related issue: https://github.com/gluestack/gluestack-ui/issues/2179

ankit-tailor commented 34 minutes ago

Hey @JDMetal, Thanks for reporting the issue. We'll look into it.