Skip to main content
Version: Bleeding Edge 🚧

Rating

Ratings are used to collect measurable feedback from users. Use Rating over an Input where imagery can increase user interaction. This component is imported from @rn-vui/ratings. There are two tyoes of rating - TapRating and SwipeRating. This documentation is for Swipe Rating version.

Import

import { Rating } from '@rn-vui/themed';

Theme Key

Rating

Usage

Read-only mode

const { rating } = this.props;

<Rating imageSize={20} readonly startingValue={rating} style={styles.rating} />;

Fractions

<Rating showRating fractions="{1}" startingValue="{3.3}" />

Fractions demo gif

Props

NameTypeDefaultDescription
fractionsany0The number of decimal places for the rating value; must be between 0 and 20
imageSizenumber50The size of each rating image
jumpValuenumber0 (not to jump)The number to jump per swipe
minValuenumber0The minimum value the user can select
onFinishRating(value: number) => voidCallback method when the user finishes rating. Gives you the final rating value as a whole number
onStartRating(value: number) => voidCallback method when the user starts rating.
onSwipeRating(value: number) => voidCallback method when the user is swiping.
ratingBackgroundColorstring'white'Pass in a custom background-fill-color for the rating icon; use this along with type='custom' prop above
ratingColorstring'#f1c40f'Pass in a custom fill-color for the rating icon; use this along with type='custom' prop above
ratingCountnumber5Number of rating images to display
ratingImageReactNodePass in a custom image source; use this along with type='custom' prop above
ratingTextColorstring#f1c40fColor used for the text labels
readonlybooleanfalseWhether the rating can be modified by the user
showRatingbooleanfalseDisplays the Built-in Rating UI to show the rating value in real-time
showReadOnlyTextbooleanfalseWhether the text is read only
startingValuenumberratingCount/2The initial rating to render
styleView StyleExposes style prop to add additional styling to the container view
tintColorstringColor used for the background
typestar | heart | rocket | bell | customstarGraphic used for represent a rating

Playground

Loading...