Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export style type #1

Open
java-james opened this issue Jan 18, 2023 · 1 comment
Open

Export style type #1

java-james opened this issue Jan 18, 2023 · 1 comment

Comments

@java-james
Copy link
Contributor

java-james commented Jan 18, 2023

By exporting the style type it will be easier for consumers to build the correct prop when using the library with typescript.

eg add

export type GradientBorderViewStyle = StyleProp<
            GradientBorderViewProps & 
            {paddingLeft?: number, paddingRight?: number, paddingTop?: number, paddingBottom?: number, padding?: number}
        >

Can use internally as needed eg:

export default function GradientBorderView({
    gradientProps,
    ...props
}: Omit<ViewProps, 'style'> &
    {
        style?: GradientBorderViewStyle
    } &
    RequiredGradientBorderProps
) {
@java-james
Copy link
Contributor Author

For anyone who requires the type while this isn't exported you can use:

type GradientBorderViewStyle = Parameters<typeof GradientBorderView>[0]["style"];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant