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

Typescript issue #24

Open
tonym95 opened this issue Nov 6, 2020 · 2 comments
Open

Typescript issue #24

tonym95 opened this issue Nov 6, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@tonym95
Copy link

tonym95 commented Nov 6, 2020

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.

@ui-ninja ui-ninja added the enhancement New feature or request label Jan 11, 2021
@panigrah
Copy link

panigrah commented May 23, 2021

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
Copy link

markrickert commented Sep 8, 2021

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

marginBetweenRatingIcon?: number

It's also missing:

size?: number

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

No branches or pull requests

4 participants