Как я могу получить контроль даты реакции Airbnb, чтобы он был изначально закрыт? - PullRequest
0 голосов
/ 11 июля 2019

У меня есть следующий код

constructor(props) {
    super(props);
    this.state = {
        startDate: null,
        endDate: null,
        focusedInput: null
    };
}

render() {
    return (
        <div>
            <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/react-dates@20.2.5/lib/css/_datepicker.css" />

            <DateRangePicker
                startDate={this.state.startDate} // momentPropTypes.momentObj or null,
                startDateId="1" // PropTypes.string.isRequired,
                endDate={this.state.endDate} // momentPropTypes.momentObj or null,
                endDateId="2" // PropTypes.string.isRequired,
                onDatesChange={({ startDate, endDate }) => this.setState({ startDate, endDate })} // PropTypes.func.isRequired,
                focusedInput={this.state.focusedInput} // PropTypes.oneOf([START_DATE, END_DATE]) or null,
                onFocusChange={focusedInput => this.setState({ focusedInput })} // PropTypes.func.isRequired,
            />
        </div>
    );
}

При переходе на правильную страницу элемент управления работает, но первоначально он отображается в открытом состоянии. Как я могу закрыть его изначально?

...