React-dates: Anyone knows how we can keep both the input and calendar visible ?

Created on 4 Aug 2017  路  2Comments  路  Source: airbnb/react-dates

Simillar with #193 .

Now we should use DayPickerRangeController for eg, if we want to keep the calendar visible all the time, but how can we show the inputs also ?

question

All 2 comments

Hi @dtalaba, sorry for the delay in response! If you want it always visible but absolutely positioned, I'd just make sure that focusedInput is never set to null ie your onFocusChange method would look like:

onFocusChange({ focusedInput }) {
  if (focusedInput) {
    this.setState({ focusedInput });
  } else {
    this.setState({ focusedInput: START_DATE });
  }
}

If you want it to be inline, you will in fact have to use DayPickerRangeController and DateRangePickerInputController and then wire up the interaction between the two yourself.

@majapw Thanks for this solution. The only change I had to make was to not destructure focusedInput from the input parameter of onFocusChange for my DateRangePicker.

Was this page helpful?
0 / 5 - 0 ratings