Skip to content

Instantly share code, notes, and snippets.

@Pasi-D
Last active May 2, 2021 14:13
Show Gist options
  • Select an option

  • Save Pasi-D/8e5f549511dd5c29d912930677e5fe07 to your computer and use it in GitHub Desktop.

Select an option

Save Pasi-D/8e5f549511dd5c29d912930677e5fe07 to your computer and use it in GitHub Desktop.
Extended Theme file for react native
import { useContext } from "react";
import { FullTheme, ButtonProps, ThemeContext } from "react-native-elements";
import { ThemeProps } from "react-native-elements/dist/config/ThemeProvider";
import { Colors } from "react-native-elements/dist/config/colors";
import { RecursivePartial } from "utils/core";
interface IExtendedThemeButtonProps extends Partial<ButtonProps> {
titleAppearances?: {
titleColors?: {
primary: string;
};
fontFamily?: string;
};
}
interface IExtendedThemeColorProps extends RecursivePartial<Colors> {
readonly darkBg: string;
}
export interface Theme extends Partial<FullTheme> {
Button?: IExtendedThemeButtonProps;
colors?: IExtendedThemeColorProps;
}
export const useThemeContext = () => useContext<ThemeProps<Theme>>(ThemeContext);
const theme: Theme = {
Button: {
raised: true,
titleAppearances: {
titleColors: {
primary: "#FFF",
},
fontFamily: "Montserrat",
},
},
colors: {
darkBg: "#0F0F0F",
},
};
export default theme;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment