Migrate from react-native-ratings
react-native-ratings hasn't had a release since May 2021, and draws its stars from bundled images. Rating draws them as text, takes any icon you already use through renderIcon, is adjustable for screen readers and steps with arrow keys on the web.
Code changes​
- import { AirbnbRating, Rating } from 'react-native-ratings';
+ import { Rating } from '@elik56a/react-native-pickers';
- <AirbnbRating
- count={5}
- defaultRating={3}
- size={24}
- selectedColor="#f1c40f"
- showRating={false}
- onFinishRating={setStars}
- />
+ <Rating defaultValue={3} size={24} color="#f1c40f" onChange={setStars} />
Props​
| react-native-ratings | React Native Pickers |
|---|---|
count / ratingCount | max (default 5) |
defaultRating / startingValue | defaultValue, or value to control it |
onFinishRating | onChange, once on a tap or the end of a drag |
onStartRating / onSwipeRating | — |
size / imageSize | size (default 32) |
selectedColor / ratingColor | color |
unSelectedColor / ratingBackgroundColor | emptyColor |
jumpValue={0.5} / fractions | step={0.5} |
minValue | taps pick at least one step; keys can go to 0 |
isDisabled / readonly | readOnly to show a score, or disabled to dim it |
type="heart" / starImage / ratingImage | renderIcon={({ color, size }) => …} |
reviews + showRating | render your own label from value |
starContainerStyle / style | styles={{ container, item }} / style |
See all migration guides for other libraries, and Comparison for when another library is the better choice.