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

Support for typescript #105

Closed
vTrip opened this issue Dec 5, 2018 · 2 comments · Fixed by #129
Closed

Support for typescript #105

vTrip opened this issue Dec 5, 2018 · 2 comments · Fixed by #129

Comments

@vTrip
Copy link

vTrip commented Dec 5, 2018

Is it possible to have typescript definitions for this library?

@nartc
Copy link

nartc commented Jun 6, 2019

@vTrip

declare module 'react-native-spinkit' {
  import React from 'react';

  export type SpinnerType =
    | 'CircleFlip'
    | 'Bounce'
    | 'Wave'
    | 'WanderingCubes'
    | 'Pulse'
    | 'ChasingDots'
    | 'ThreeBounce'
    | 'Circle'
    | '9CubeGrid'
    | 'WordPress'
    | 'FadingCircle'
    | 'FadingCircleAlt'
    | 'Arc'
    | 'ArcAlt'
    | 'Plane';

  export type SpinnerProps = {
    isVisible: boolean;
    color?: string;
    size?: number;
    type?: SpinnerType;
  };

  const Spinner: React.ComponentType<SpinnerProps>;
  export default Spinner;
}

While waiting for typescript support, you can do the following:

  1. At your root, make a .d.ts file. You can name it anything you want.
  2. Copy and paste the snippet above.

@steffenagger
Copy link

steffenagger commented Aug 6, 2019

@vTrip It looks like isVisible is also optional - see:

isVisible: true

But thanks! Just what I needed.

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