3

We have installed react-datepicker component. The default behaviour is that the calendar is getting opened on tab keypress from previous field. How can I avoid this. Please suggest as I am unable to override the default behaviour of this component. I just want the focus to be on this control when tab is pressed.

pratham gn
  • 95
  • 1
  • 4
  • 14

2 Answers2

3

You can use preventOpenOnFocus property

<DatePicker
  ...
  preventOpenOnFocus={true}
/>
0

You can open it manually:

<DatePicker
   ref={(c) => this._calendar = c}
   locale='ru'
    ...
   customInput={<InputField {...this.props} calendar={this._calendar}/>}
/>

And then somewhere

this._calendar.setOpen(bool)
Meghshyam Sonar
  • 394
  • 3
  • 12