react-bootstrap-datetimepicker icon indicating copy to clipboard operation
react-bootstrap-datetimepicker copied to clipboard

add disabled option

Open erdinc opened this issue 9 years ago • 2 comments

Can we add attribute like disabled={true} ?

erdinc avatar Jul 14 '16 11:07 erdinc

+1

marlon407 avatar Jul 25 '16 14:07 marlon407

If you want to control the disabled state of this input, a simple manipulation of the DOM element using ref did the job for me.

For example:

<DateTimePicker
  ...
  ref={(dateRef) => {
  if (!disabled) {
    return;
  }
  const dateTimePicker = dateRef && dateRef.refs && dateRef.refs.datetimepicker;
  if (dateTimePicker) {
    for (const domElem of dateTimePicker.childNodes) {
      if (domElem.tagName === 'INPUT' &&  domElem.className === 'form-control') {
          domElem.disabled = true;
      }
    }
  }
}}/>

relacsua avatar Dec 08 '16 05:12 relacsua