Skip to content
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
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,20 @@ If you want to **customize** `(minusIcon, plusIcon)` the buttons [USE_CUSTOM_ICO
Some default props and descriptions.


| PropName | Description | type | Default |
|-----------------|:-----------------------------------------------------:|---------:|--------:|
| minus | If you are not using minusIcon, it shows directly. | String | - |
| plus | If you are not using plusIcon, it shows directly. | String | + |
| start | The starting number | Number | 0 |
| min | Minus the minimum selected number. | Number | 0 |
| max | The most selectable number. | Number | 10 |
| minusIcon | You can use it to change the minusIcon. | Function | null |
| plusIcon | You can use it to change the plusIcon. | Function | null |
| buttonStyle | You can change the types of all buttons. | Object | {} |
| buttonTextStyle | Minus or plus styles in the button | Object | {} |
| countTextStyle | styles of increasing number. | Object | {} |
| increment | You can use it to change the increment between steps. | Number | 1 |
| PropName | Description | type | Default |
|-----------------|:-----------------------------------------------------:|---------:|--------------------:|
| minus | If you are not using minusIcon, it shows directly. | String | - |
| plus | If you are not using plusIcon, it shows directly. | String | + |
| start | The starting number | Number | 0 |
| min | Minus the minimum selected number. | Number | 0 |
| max | The most selectable number. | Number | 10 |
| minusIcon | You can use it to change the minusIcon. | Function | null |
| plusIcon | You can use it to change the plusIcon. | Function | null |
| buttonStyle | You can change the types of all buttons. | Object | {} |
| buttonTextStyle | Minus or plus styles in the button | Object | {} |
| countTextStyle | styles of increasing number. | Object | {} |
| increment | You can use it to change the increment between steps. | Number | 1 |
| formatFn | A function which returns a formatted count. | Function |(count) => \`${count}\`|


### Contributing
Expand Down
4 changes: 2 additions & 2 deletions src/components/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class Counter extends Component {

render() {
const { count, beforeLoading } = this.state;
const { countTextStyle } = this.props;
const { countTextStyle, formatFn = (count) => `${count}` } = this.props;

return (
<View style={Styles.container}>
Expand All @@ -59,7 +59,7 @@ export default class Counter extends Component {

<View style={Styles.count}>
<ScalableText style={[Styles.countText, countTextStyle]}>
{count}
{formatFn(count)}
</ScalableText>
</View>

Expand Down