react-ui-kit / expo-ui-kit

expo-ui-kit - a components based React-Native UI Kit
http://expo-ui-kit.com
MIT License
94 stars 25 forks source link

Access theme constants in your own source code. #81

Open arfemia opened 3 years ago

arfemia commented 3 years ago

All that needs to be done is adding the following to index.d.ts in expo-ui-kit/src:

...
export declare const theme: {
  COLORS: {
    font: string;
    primary: string;
    secondary: string;
    tertiary: string;
    black: string;
    white: string;
    gray: string;
    error: string;
    warning: string;
    success: string;
    info: string;
  },
  SIZES: {
    base: number;
    font: number;
    radius: number;
    padding: number;
    h1: number;
    h2: number;
    h3: number;
    title: number;
    subtitle: number;
    caption: number;
    small: number;
    width: number;
    height: number;
  },

  FONTS: {
    h1: {
      fontSize: number;
      letterSpacing: number;
    };
    h2: {
      fontSize: number;
      letterSpacing: number;
    };
    h3: {
      fontSize: number;
      letterSpacing: number;
    };
    title: {
      fontSize: number;
      letterSpacing: number;
    };
    subtitle: {
      fontSize: number;
    };
    caption: {
      fontSize: number;
      letterSpacing: number;
    };
    small: {
      fontSize: number;
      letterSpacing: number;
    };
  },

  WEIGHTS: {
    regular: string;
    bold: string;
    semibold: string;
    medium: string;
    light: string;
  }

}
...
hetmann commented 3 years ago

Thank you for your feedback! I was thinking to rewrite expo-ui-kit using TS & publish it compiled :)