Rudeg / react-input-calendar

http://rudeg.github.io/react-input-calendar/
MIT License
139 stars 94 forks source link

issue with openOnInputFocus #88

Closed caranicas closed 6 years ago

caranicas commented 8 years ago

hey there,

I am noticing a bug functionality with the openOnInputFocus prop.

I logged things out, and the set visibility function works the same, and in last check they both set isVisible to true.

if (this.state.isVisible !== value && !this.props.disabled) {
     this.setState({ isVisible: value });
}

However then when you get to the render function the visibility bool is flipped back to to false when i click from the icon so it passes over the ternary to create item, however when you focus from the input the visibility is set to true (which makes sense, but makes calendar equal to the empty string) .

var calendar = !this.state.isVisible ? '' : _react2.default.createElement(
        'div',
        { className: calendarClass, onClick: this.calendarClick },
        view,
        _react2.default.createElement(
          'span',
          {
            className: 'today-btn' + (this.checkIfDateDisabled((0, _moment2.default)().startOf('day')) ? ' disabled' : ''),
            onClick: this.todayClick },
          todayText
        )
      );

Ill do some more logging, and see what I can figure out, but I thought you might have a better idea, of where that bool might be getting reset to false.

Rudeg commented 6 years ago

should be fixed in current version