import type { ComponentType } from 'react' import { DripsyFinalTheme } from '../declarations' import { createThemedComponent } from './create-themed-component' import type { ThemedOptions } from './types' /** * `styled` is little more than a recreation of `createThemedComponent`, with a nicer API. It does the same thing, but looks a bit nicer to use and has a clean name 😇 * * ```jsx * import { Text } from 'react-native' * * const MyText = styled(Text)({ * borderBottomStyle: 'solid', * color: ['primary', 'secondary'] * }) * ``` * */ export function styled< Props, C extends ComponentType = ComponentType, ThemeKey extends keyof DripsyFinalTheme = keyof DripsyFinalTheme >( Component: C, { themeKey, defaultVariant, }: Pick, 'themeKey' | 'defaultVariant'> = {} ) { return function dripsyFactory( defaultStyle?: ThemedOptions['defaultStyle'] ) { return createThemedComponent(Component, { defaultVariant, themeKey, defaultStyle, }) } }