0.7.0 • Published 4 years ago

@dooboo-ui/native-rating v0.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Rating

Simple rating component for react-native. This component supports 'rating' with several options like changing with total number, read-only and disabled option.

Props

PropertyRequiredTypesDefaultDescription
totalnumberset the total rating value
valuenumberset the rating value that will show on the screen. (The value will automatically round down.)
onChangefunc() => {}set the handler to handle change event
disabledbooleanfalsedisabled state of rating

Usage

interface RatingChangeProps {
  value: number;
}

const [value, setValue] = React.useState(0);

const handleChange = (props: RatingChangeProps): void => {
    setValue(props.value);
}

// Change rating value with press each of components
<Rating total={5} value={value} onChange={handleChange} />

// Read only
<Rating total={5} value={value} />

// Disabled
<Rating total={5} value={value} disabled />