ui-ninja / react-native-rating-element

A simple rating library for react native supporting: decimal points, direction aware icons, custom icon set from Ionicons, custom images and record rating given by users.
MIT License
25 stars 5 forks source link

Typescript issue #24

Open tonym95 opened 4 years ago

tonym95 commented 4 years ago

It seems that this library is missing a type definition file and there is none added so far in DefinitelyTyped repo, will that be added in the future? I'm pretty new to typescript myself, so I'm not really sure I can add one.

panigrah commented 3 years ago

copy this into a file called react-native-rating-element.d.ts anywhere in your project source code.


declare module 'react-native-rating-element' {
  import { ViewStyle } from 'react-native'

  interface RatingProps {
    rated?: number
    totalCount?: number
    type?: string
    selectedIconImage?: JSX.Element | JSX.Element[]
    emptyIconImage?: JSX.Element | JSX.Element[]
    readonly?: boolean
    direction?: string
    onIconTap?: (value: number) => void
    ratingColor?: string
    ratingBackgroundColor?: string
    icon?: string
    marginBetweenRatingIcon: 1
    style?: ViewStyle
  }

  export const Rating: (props: RatingProps) => any  
}
markrickert commented 3 years ago

There's an error in the type interface above. marginBetweenRatingIcon should be:

marginBetweenRatingIcon?: number

It's also missing:

size?: number