// Type definitions for Glamorous v3.2.0 // Project: https://github.com/paypal/glamorous // Definitions by: Kok Sam import * as React from 'react' import { NativeComponent } from './built-in-glamorous-components' import { NativeComponentFactory, ComponentKey, } from './built-in-component-factories' import { GlamorousComponent, ExtraGlamorousProps } from './glamorous-component' import { BuiltInGlamorousComponentFactory, KeyGlamorousComponentFactory, KeyGlamorousComponentFactoryCssOverides, GlamorousComponentFactory, GlamorousComponentFactoryCssOverides, } from './component-factory' import { StyleFunction, StyleArray, StyleArgument } from './style-arguments' import { Omit } from './helpers' import { TextStyle, ViewStyle, ImageStyle, StyleProp, } from 'react-native' export { GlamorousComponent, ExtraGlamorousProps, StyleFunction, StyleArray, StyleArgument, BuiltInGlamorousComponentFactory, KeyGlamorousComponentFactory, KeyGlamorousComponentFactoryCssOverides, GlamorousComponentFactory, GlamorousComponentFactoryCssOverides, NativeComponent, NativeComponentFactory, ComponentKey, } export interface GlamorousOptions { displayName: string rootEl: string | ComponentType forwardProps: String[] shouldClassNameUpdate: ( props: Props, prevProps: Props, context: Context, prevContext: Context ) => boolean propsAreCssOverrides?: false withProps: DefaultProps } export interface PropsAreCssOverridesGlamorousOptions< Props, Context, DefaultProps > { displayName?: string rootEl?: string | ComponentType forwardProps?: String[] shouldClassNameUpdate?: ( props: Props, prevProps: Props, context: Context, prevContext: Context ) => boolean propsAreCssOverrides: true withProps?: DefaultProps } export type Component = | React.ComponentClass | React.StatelessComponent type OmitInternals = Omit< Props, keyof GlamorousProps > type GlamorousProps = { theme?: object } type AllStyles = TextStyle | ViewStyle | ImageStyle export interface GlamorousInterface extends NativeComponentFactory, NativeComponent { < ExternalProps extends { style?: StyleProp }, StyleType = ExternalProps['style'], Context = object, DefaultProps extends object = object >( component: Component< ExternalProps & GlamorousProps & { style?: StyleType } >, options?: Partial> ): GlamorousComponentFactory // # Glamarous Component factories // Two overloads are needed per shape due to a union return of CSSProperties | SVGProperties // resulting in a loss of typesafety on function arguments // ## create a component factory from your own component } interface ThemeProps { theme: object } export class ThemeProvider extends React.Component {} export function withTheme( component: React.ComponentClass ): React.ComponentClass> export function withTheme( component: React.StatelessComponent ): React.StatelessComponent> declare const glamorous: GlamorousInterface export default glamorous