import React, { ComponentProps, ComponentType, JSXElementConstructor, ReactElement, ReactNode } from 'react'; import { ViewStyle, TextStyle, ImageStyle } from 'react-native'; /** * Types definition * * @internal */ /** * For overlap `DefaultTheme` use: * * styl.d.ts * * declare module 'react-native-styl' { * export interface DefaultTheme { * colors: { * main: string; * secondary: string; * }; * } * } */ export interface DefaultTheme { } /** * Theme */ declare type StyleProperties = ViewStyle | TextStyle | ImageStyle; declare type StylesWithTheme

= (args: { props: P; theme: DefaultTheme; }) => StyleProperties; declare type Styles

= StylesWithTheme

| StyleProperties; /** * Props */ declare type DefaultProps = object & { as?: ComponentType; children?: ReactNode; }; declare type Merge = Omit & P2; declare type ForwardRefExoticComponent = React.ForwardRefExoticComponent : never, OwnProps & { as?: E; }>>; /** * Polymorphic */ interface Polymorphic, OwnProps = {}> extends ForwardRefExoticComponent { | undefined>(props: As extends JSXElementConstructor ? Merge : Merge, OwnProps>): ReactElement | null; } /** * Provider * * It receives a theme as argument, to provide custom * variables to entire react component tree via context * * Usage: * ```jsx * const ThemeA: React.FC = ({ children }) => ( * * {children} * * ) * ``` */ declare const Provider: React.FC>; /** * useTheme * * Expose the `theme` as a React hook */ declare const useTheme: () => DefaultTheme; /** * styl * * Given a component as first argument, it return a function * which receives a callback with `theme` (from context) and `props` * from component and should be returned a CSSProperties which * will be passes as `style` attribute * * @example * ```tsx * const Title = styl(Text)(({ theme, props }) => ({ * paddingLeft: props.padding, * color: theme.primary, * })); * * const BigTitle = styl(Title)({ fontSize: 40 }) * ``` */ declare const styl: >(Component: Comp) => (stylesProp: Styles) => Polymorphic; export { styl, Provider, useTheme }; //# sourceMappingURL=styl.d.ts.map