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

fix issue #104 : Customize backgroundColor when using built-in image types #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Install the package using yarn or npm:
```yarn add react-native-ratings```

OR

```npm install --save react-native-ratings```

## Usage
Expand Down Expand Up @@ -116,6 +116,7 @@ Also refer to the [`example`](https://github.com/Monte9/react-native-ratings/tre
| ratingBackgroundColor | `white` | string (color) | Pass in a custom background-fill-color for the rating icon; use this along with `type='custom'` prop above (optional) |
| ratingCount | 5 | number | The number of rating images to display (optional) |
| ratingTextColor | none | string | Color used for the text labels |
| emptyBackgroundColor | `white` | string | Color used for the unfilled proportion background |
| imageSize | 50 | number | The size of each rating image (optional) |
| showRating | none | boolean | Displays the Built-in Rating UI to show the rating value in real-time (optional) |
| readonly | false | boolean | Whether the rating can be modiefied by the user |
Expand Down
4 changes: 2 additions & 2 deletions src/SwipeRating.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class SwipeRating extends Component {

getSecondaryViewStyle() {
const { position } = this.state;
const { imageSize, ratingCount, type } = this.props;
const { imageSize, ratingCount, type, emptyBackgroundColor } = this.props;

const backgroundColor = TYPES[type].backgroundColor;

Expand All @@ -145,7 +145,7 @@ export default class SwipeRating extends Component {
);

return {
backgroundColor,
backgroundColor: emptyBackgroundColor || backgroundColor,
width,
height: width ? imageSize : 0
};
Expand Down