0

I have a wrapper React component which returns a DatePicker:

import React from 'react';
import DatePicker from 'react-datepicker';
import moment from 'moment';

export default class MyDatePicker extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      startDate: moment()
    };
  }

  handleChange(date) {
    this.setState({
      startDate: date
    });
  }

  render() {
    return <DatePicker
        selected={this.state.startDate}
        onChange={this.handleChange.bind(this)}
        />;
  }
}

Eventually it will be more complex, but for right now it just returns the DatePicker. The problem is that when I try to use this component, a pre-filled date field is displayed as expected, but when I click in the field the calendar popover does not open. What do I need to do to get the calendar popover to open? How can I troubleshoot this issue?

kat
  • 5,645
  • 4
  • 19
  • 35

1 Answers1

2

import 'react-datepicker/dist/react-datepicker.css' and 'react-datepicker/dist/react-datepicker-cssmodules.css'

kat
  • 5,645
  • 4
  • 19
  • 35