import { ComponentPropsWithoutRef, ComponentType, NamedExoticComponent, PropsWithChildren } from 'react'; import * as RN from 'react-native'; import { ReactNativeStyle, ReactNativeStyleType, Theme } from './StyleSheet'; export declare type ReactNative = typeof RN; export declare type ReactNativeComponentNames = 'ActivityIndicator' | 'Button' | 'DatePickerIOS' | 'DrawerLayoutAndroid' | 'FlatList' | 'Image' | 'ImageBackground' | 'KeyboardAvoidingView' | 'ListView' | 'Modal' | 'NavigatorIOS' | 'Picker' | 'PickerIOS' | 'ProgressBarAndroid' | 'ProgressViewIOS' | 'RecyclerViewBackedScrollView' | 'RefreshControl' | 'SafeAreaView' | 'ScrollView' | 'SectionList' | 'SegmentedControlIOS' | 'Slider' | 'SnapshotViewIOS' | 'StatusBar' | 'SwipeableListView' | 'Switch' | 'SwitchIOS' | 'TabBarIOS' | 'Text' | 'TextInput' | 'ToolbarAndroid' | 'TouchableHighlight' | 'TouchableNativeFeedback' | 'TouchableOpacity' | 'TouchableWithoutFeedback' | 'View' | 'ViewPagerAndroid'; export declare type ReactNativeComponents = Pick; export declare type ReactNativeComponentProps = ComponentPropsWithoutRef; export declare type InterpolationPrimitive = null | undefined | boolean | number | string | ObjectInterpolation; export declare type ObjectInterpolation = StyleType; export interface ArrayCSSInterpolation extends Array> { } export declare type CSSInterpolation = InterpolationPrimitive | ArrayCSSInterpolation; export interface ArrayInterpolation extends Array> { } export interface FunctionInterpolation { (mergedProps: MergedProps): Interpolation; } export declare type Interpolation = InterpolationPrimitive | ArrayInterpolation | FunctionInterpolation; /** Same as StyledOptions but getShouldForwardProp must be a type guard */ export interface FilteringStyledOptions { shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps; } export interface StyledOptions { shouldForwardProp?(propName: keyof Props): boolean; } /** * @typeparam ComponentProps Props which will be included when withComponent is called * @typeparam SpecificComponentProps Props which will *not* be included when withComponent is called */ export interface StyledComponent extends NamedExoticComponent> { withComponent>>(component: Component): StyledComponent>; withComponent(component: ReactNativeComponents[ComponentName]): StyledComponent>; } /** * @typeparam ComponentProps Props which will be included when withComponent is called * @typeparam SpecificComponentProps Props which will *not* be included when withComponent is called */ export interface CreateStyledComponent { /** * @typeparam AdditionalProps Additional props to add to your styled component */ (...styles: ArrayInterpolation): StyledComponent; /** * @typeparam AdditionalProps Additional props to add to your styled component */ (template: TemplateStringsArray, ...styles: ArrayInterpolation): StyledComponent; } /** * @desc * This function accepts a React component. * * @example styled(MyComponent)({ width: 100 }) * @example styled(MyComponent)(myComponentProps => ({ width: myComponentProps.width }) * @example styled(View)({ width: 100 }) * @example styled(View)(props => ({ width: props.width }) */ export interface CreateStyled { >, ForwardedProps extends keyof ComponentPropsWithoutRef = keyof ComponentPropsWithoutRef>(component: Component, options: FilteringStyledOptions, ForwardedProps>): CreateStyledComponent, ForwardedProps> & { theme?: Theme; }, {}, ReactNativeStyleType>>; >>(component: Component, options?: StyledOptions>): CreateStyledComponent & { theme?: Theme; }, {}, ReactNativeStyleType>>; = keyof ReactNativeComponentProps>(component: ReactNativeComponents[ComponentName], options: FilteringStyledOptions, ForwardedProps>): CreateStyledComponent<{ theme?: Theme; }, Pick, ForwardedProps>, ReactNativeStyleType>>; (component: ReactNativeComponents[ComponentName], options?: StyledOptions>): CreateStyledComponent<{ theme?: Theme; }, ReactNativeComponentProps, ReactNativeStyleType>>; } export interface CreateStyledExtended { >, ForwardedProps extends keyof ComponentPropsWithoutRef = keyof ComponentPropsWithoutRef>(component: Component, options: FilteringStyledOptions, ForwardedProps>): CreateStyledComponent, ForwardedProps> & { theme?: Theme; }, {}, ReactNativeStyleType>>; >>(component: Component, options?: StyledOptions>): CreateStyledComponent & { theme?: Theme; }, {}, ReactNativeStyleType>>; = keyof ReactNativeComponentProps>(component: ReactNativeComponents[ComponentName], options: FilteringStyledOptions, ForwardedProps>): CreateStyledComponent<{ theme?: Theme; }, Pick, ForwardedProps>, ReactNativeStyleType>>; (component: ReactNativeComponents[ComponentName], options?: StyledOptions>): CreateStyledComponent<{ theme?: Theme; }, ReactNativeComponentProps, ReactNativeStyleType>>; }