Skip to content

Commit

Permalink
fix: replace deprecated onKeyPress by onKeyDown
Browse files Browse the repository at this point in the history
  • Loading branch information
zaosoula committed Mar 4, 2024
1 parent c6f8687 commit 21f51f2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
24 changes: 11 additions & 13 deletions src/DayColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,33 @@ class DayColumn extends React.Component {
this.clearTimeIndicatorInterval()
}

UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.selectable && !this.props.selectable) this._selectable()
if (!nextProps.selectable && this.props.selectable)
this._teardownSelectable()
componentDidUpdate(prevProps, prevState) {
if (this.props.selectable && !prevProps.selectable) this._selectable();
if (!this.props.selectable && prevProps.selectable)
this._teardownSelectable();

this.slotMetrics = this.slotMetrics.update(nextProps)
}
this.slotMetrics = this.slotMetrics.update(this.props);

componentDidUpdate(prevProps, prevState) {
const { getNow, isNow, localizer, date, min, max } = this.props
const getNowChanged = localizer.neq(prevProps.getNow(), getNow(), 'minutes')
const { getNow, isNow, localizer, date, min, max } = this.props;
const getNowChanged = localizer.neq(prevProps.getNow(), getNow(), 'minutes');

if (prevProps.isNow !== isNow || getNowChanged) {
this.clearTimeIndicatorInterval()
this.clearTimeIndicatorInterval();

if (isNow) {
const tail =
!getNowChanged &&
localizer.eq(prevProps.date, date, 'minutes') &&
prevState.timeIndicatorPosition === this.state.timeIndicatorPosition
prevState.timeIndicatorPosition === this.state.timeIndicatorPosition;

this.setTimeIndicatorPositionUpdateInterval(tail)
this.setTimeIndicatorPositionUpdateInterval(tail);
}
} else if (
isNow &&
(localizer.neq(prevProps.min, min, 'minutes') ||
localizer.neq(prevProps.max, max, 'minutes'))
) {
this.positionTimeIndicator()
this.positionTimeIndicator();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/EventCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class EventCell extends React.Component {
})}
onClick={(e) => onSelect && onSelect(event, e)}
onDoubleClick={(e) => onDoubleClick && onDoubleClick(event, e)}
onKeyPress={(e) => onKeyPress && onKeyPress(event, e)}
onKeyDown={(e) => onKeyPress && onKeyPress(event, e)}
>
{typeof children === 'function' ? children(content) : content}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/TimeGridEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function TimeGridEvent(props) {
onClick={onClick}
onDoubleClick={onDoubleClick}
style={eventStyle}
onKeyPress={onKeyPress}
onKeyDown={onKeyPress}
title={
tooltip
? (typeof label === 'string' ? label + ': ' : '') + tooltip
Expand Down
2 changes: 1 addition & 1 deletion src/TimeGridHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class TimeGridHeader extends React.Component {
onSelect={this.props.onSelectEvent}
onShowMore={this.props.onShowMore}
onDoubleClick={this.props.onDoubleClickEvent}
onKeyPress={this.props.onKeyPressEvent}
onKeyDown={this.props.onKeyPressEvent}
onSelectSlot={this.props.onSelectSlot}
longPressThreshold={this.props.longPressThreshold}
resizable={resizable}
Expand Down

0 comments on commit 21f51f2

Please sign in to comment.