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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Run `npm install react-native-countdown-component --save` OR `yarn add react-nat
| Name | Description | Type | Default Value |
| :--- | :----- | :--- | :---: |
| style | Override the component style | object | {} |
| countDownContainerStyle | Count Down Style | object | {} |
| digitStyle | Digit style | object | {backgroundColor: ![#FAB913](https://placehold.it/15/FAB913/000000?text=+) `'#FAB913'`} |
| digitTxtStyle | Digit Text style | object | {color: ![#FAB913](https://placehold.it/15/000000/000000?text=+) `'#000'`} |
| timeLabelStyle | Time Label style | object | {color: ![#FAB913](https://placehold.it/15/000000/000000?text=+) `'#000'`} |
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const DEFAULT_TIME_LABELS = {

class CountDown extends React.Component {
static propTypes = {
countDownContainerStyle: PropTypes.object,
digitStyle: PropTypes.object,
digitTxtStyle: PropTypes.object,
timeLabelStyle: PropTypes.object,
Expand Down Expand Up @@ -177,15 +178,15 @@ class CountDown extends React.Component {
};

renderCountDown = () => {
const {timeToShow, timeLabels, showSeparator} = this.props;
const {timeToShow, timeLabels, showSeparator, countDownContainerStyle} = this.props;
const {until} = this.state;
const {days, hours, minutes, seconds} = this.getTimeLeft();
const newTime = sprintf('%02d:%02d:%02d:%02d', days, hours, minutes, seconds).split(':');
const Component = this.props.onPress ? TouchableOpacity : View;

return (
<Component
style={styles.timeCont}
style={{...styles.timeCont, ...countDownContainerStyle}}
onPress={this.props.onPress}
>
{timeToShow.includes('D') ? this.renderDoubleDigits(timeLabels.d, newTime[0]) : null}
Expand All @@ -209,6 +210,7 @@ class CountDown extends React.Component {
}

CountDown.defaultProps = {
countDownContainerStyle: {},
digitStyle: DEFAULT_DIGIT_STYLE,
digitTxtStyle: DEFAULT_DIGIT_TXT_STYLE,
timeLabelStyle: DEFAULT_TIME_LABEL_STYLE,
Expand Down