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

Hide indicator when current time is not in the interval #1639

Merged
merged 1 commit into from
May 12, 2020
Merged
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 src/DayColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class DayColumn extends React.Component {

if (current >= min && current <= max) {
const top = this.slotMetrics.getCurrentTimePosition(current)
this.intervalTriggered = true
this.setState({ timeIndicatorPosition: top })
} else {
this.clearTimeIndicatorInterval()
Expand Down Expand Up @@ -163,7 +164,7 @@ class DayColumn extends React.Component {
<span>{localizer.format(selectDates, 'selectRangeFormat')}</span>
</div>
)}
{isNow && (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this check if the position is != null instead of a new flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for delay! It's not new flag, i just added a checking for this flag. Based on flag name, i think this checking was just forgotten. If you use a position, you need to reset it (and add a new code), otherwise the indicator will get stuck at the bottom over time. So, I think these approaches are equivalent and the current edits are quite sufficient.

{isNow && this.intervalTriggered && (
<div
className="rbc-current-time-indicator"
style={{ top: `${this.state.timeIndicatorPosition}%` }}
Expand Down