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

Show Hide Control On Time Labels #80

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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Run `npm install react-native-countdown-component --save` OR `yarn add react-nat
| onPress | What function should be invoked when clicking on the timer | func | null |
| timeToShow | What Digits to show | array | ['D', 'H', 'M', 'S'] |
| timeLabels | Text to show in time label | object | {d: 'Days', h: 'Hours', m: 'Minutes', s: 'Seconds'} |
| showTimeLabels | Show or hide time label | bool | true |
| showSeparator | Should show separator | bool | false |
| running | a boolean to pause and resume the component | bool | true |

Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CountDown extends React.Component {
digitStyle: PropTypes.object,
digitTxtStyle: PropTypes.object,
timeLabelStyle: PropTypes.object,
showTimeLabels:PropTypes.bool,
separatorStyle: PropTypes.object,
timeToShow: PropTypes.array,
showSeparator: PropTypes.bool,
Expand Down Expand Up @@ -165,12 +166,13 @@ class CountDown extends React.Component {
};

renderDoubleDigits = (label, digits) => {
const { showTimeLabels } = this.props;
return (
<View style={styles.doubleDigitCont}>
<View style={styles.timeInnerCont}>
{this.renderDigit(digits)}
</View>
{this.renderLabel(label)}
{showTimeLabels && this.renderLabel(label)}
</View>
);
};
Expand Down Expand Up @@ -227,6 +229,7 @@ CountDown.defaultProps = {
digitTxtStyle: DEFAULT_DIGIT_TXT_STYLE,
timeLabelStyle: DEFAULT_TIME_LABEL_STYLE,
timeLabels: DEFAULT_TIME_LABELS,
showTimeLabels:true,
separatorStyle: DEFAULT_SEPARATOR_STYLE,
timeToShow: DEFAULT_TIME_TO_SHOW,
showSeparator: false,
Expand Down