Skip to content

Commit a4f9f30

Browse files
author
Rishabh
committed
2 parents 1590c5e + 2651506 commit a4f9f30

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

README.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,56 +33,42 @@ import { Rating } from "react-native-rating-element";
3333
ratingColor="#f1c644"
3434
ratingBackgroundColor="#d4d4d4"
3535
size={24}
36-
readonly
36+
readonly // by default is false
3737
icon="ios-star"
38-
direction="row"
38+
direction="row" // anyOf["row" (default), "row-reverse", "column", "column-reverse"]
3939
/>
4040

41-
**Custom Image**
41+
**Custom Image, onIconTap and bottom to top direction**
4242
<Rating
4343
rated={3.7}
4444
totalCount={5}
4545
size={42}
4646
onIconTap={position => console.log(`User pressed: ${position}`)}
47-
direction="row"
48-
type="custom"
47+
direction="column-reverse"
48+
type="custom" // default is always to "icon"
4949
selectedIconImage={require('./filled.png')}
5050
emptyIconImage={require('./empty.png')}
5151
/>
5252

53-
**If you want to record user tap on star icon**
54-
55-
<Rating
56-
rated={3.7}
57-
totalCount={5}
58-
ratingColor="#f1c644"
59-
ratingBackgroundColor="#d4d4d4"
60-
size={24}
61-
onIconTap={position => console.log(`User pressed: ${position}`)}
62-
icon="ios-star"
63-
direction="row"
64-
/>
65-
66-
6753
```
6854

6955
## API
7056

7157
| prop | default | type | description |
7258
| ------------------------- | ---------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73-
| `type` | `icon` | string | Be default the value is set to "icon" type. If you want custom images, then pass `custom` as prop value. <br />In case of `custom`, Make sure to pass `selectedIconImage` and `emptyIconImage`. | |
7459
| `rated` | 0 | number | Represents Initial value for the rating. |
7560
| `totalCount` | 5 | number | Number of background stars to show. For ex. Rated 5 out of 10 stars. The 10 value is `totalCount` |
61+
| `type` | `icon` | string | If you want custom images, then pass `custom` as prop value. <br />In case of `custom`, Make sure to pass `selectedIconImage` and `emptyIconImage`. |
62+
| `selectedIconImage` | - | image path (node) | Pass in custom path for selected icon. For ex. `selectedIconImage={require('../pathToImage/image.png}`. |
63+
| `emptyIconImage` | - | image path (node) | Pass in custom path for selected icon. For ex. `emptyIconImage={require('../pathToImage/image.png}`. |
64+
| `readonly` | false | bool | If passed true, onPress event won't be fired. |
65+
| `direction` | 'row' | string | Pass any value from `[ "row", "row-reverse", "column", "column-reverse"]`. | |
66+
| `onIconTap` | - | func | On press of star icon by user, this function will be invoked with `position` paramter. For ex. when user taps on 4 rating, this function will be invoked and in `position` parameter you will get value 4. |
7667
| `ratingColor` | #f1c644 | string (color) | Pass in a custom color to fill-color the rating icon. |
7768
| `ratingBackgroundColor` | #d4d4d4 | string (color) | Pass in a custom fill-color for the background of rating icon. It is sometimes referred as empty icon. |
7869
| `size` | 24 | number | Pass in a custom font size for the icon |
7970
| `icon` | 'ios-star' | string | Pass in a custom text for the icon. For ex. 'beer', 'bulb'. These icons are imported from package [react-native-vector-icons](https://oblador.github.io/react-native-vector-icons/). Please Note: For now this package only support Ionicons |
8071
| `marginBetweenRatingIcon` | 1 | number | Pass in custom number to manage space or margin between the rating icons. |
81-
| `onIconTap` | - | func | On press of star icon by user, this function will be invoked with `position` paramter. For ex. when user taps on 4 rating, this function will be invoked and in `position` parameter you will get value 4. |
82-
| `readonly` | false | bool | If passed true, onPress event won't be fired. |
83-
| `direction` | 'row' | string | Pass any value from `[ "row", "row-reverse", "column", "column-reverse"]`. |
84-
| `selectedIconImage` | - | image path (node) | Pass in custom path for selected icon. For ex. `selectedIconImage={require('../pathToImage/image.png}`. |
85-
| `emptyIconImage` | - | image path (node) | Pass in custom path for selected icon. For ex. `emptyIconImage={require('../pathToImage/image.png}`. |
8672

8773
## Output
8874

0 commit comments

Comments
 (0)