Skip to content

Commit

Permalink
fix: not jump over 0th cell on ArrowLeft press
Browse files Browse the repository at this point in the history
  • Loading branch information
arfedulov committed Dec 31, 2018
1 parent c1ad726 commit 394470c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class DateTimeForm extends React.Component<any, any> {
clearable={clearable}
value={this.state.dateTime}
iconPosition='left'
minDate={moment('2018-12-31 10:20')}
preserveViewMode={false}
autoComplete='off'
onChange={this.handleChange}
Expand Down
5 changes: 3 additions & 2 deletions src/pickers/BasePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as keyboardKey from 'keyboard-key';
import {
includes,
isNil,
isNumber,
} from 'lodash';
import { Moment } from 'moment';
Expand Down Expand Up @@ -169,7 +170,7 @@ abstract class BasePicker<P extends BasePickerProps> extends React.Component<P,
switch (key) {
case 'ArrowLeft':
event.preventDefault();
if (nextSelectableCellPositionLeft) {
if (!isNil(nextSelectableCellPositionLeft)) {
this.onHoveredCellPositionChange(null, { itemPosition: nextSelectableCellPositionLeft });
} else {
if (this.isPrevPageAvailable()) {
Expand All @@ -183,7 +184,7 @@ abstract class BasePicker<P extends BasePickerProps> extends React.Component<P,
break;
case 'ArrowRight':
event.preventDefault();
if (nextSelectableCellPositionRight) {
if (!isNil(nextSelectableCellPositionRight)) {
this.onHoveredCellPositionChange(null, { itemPosition: nextSelectableCellPositionRight });
} else {
if (this.isNextPageAvailable()) {
Expand Down

0 comments on commit 394470c

Please sign in to comment.