@kirz/react-native-toolkit
Version:
Toolkit to speed up React Native development
27 lines • 1.16 kB
TypeScript
import Color from 'color';
import React, { PropsWithChildren } from 'react';
import type { TextStyle } from 'react-native';
import { ViewStyle } from '../index';
import type { Theme, ThemeAlertConfig, ThemeGradientValue } from '../theme';
type ColorData = ConstructorParameters<typeof Color>[0];
type ColorModel = ConstructorParameters<typeof Color>[1];
export type UseTheme<T extends Theme> = {
typography: Record<keyof T['typography'], TextStyle>;
fonts: T['fonts'];
colors: Record<keyof T['colors'], string>;
gradients: Record<keyof T['gradients'], ThemeGradientValue>;
values: Record<keyof T['values'], number>;
alerts: Record<keyof T['alerts'], ThemeAlertConfig>;
getContrastColor: (color: string) => 'black' | 'white';
parseColor: (obj: ColorData, model?: ColorModel) => Color;
};
export type ThemeContextType = {
theme: UseTheme<Theme>;
skeletonStyle: ViewStyle | null;
};
export declare const ThemeContext: React.Context<ThemeContextType>;
export declare function ThemeProvider({ children, theme, }: PropsWithChildren<{
theme: Theme;
}>): JSX.Element;
export {};
//# sourceMappingURL=ThemeContext.d.ts.map