New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for disabled inputs #680

Closed
kostiantyn-solianyk opened this Issue Mar 29, 2018 · 4 comments

Comments

4 participants
@kostiantyn-solianyk

kostiantyn-solianyk commented Mar 29, 2018

I want to disable DayPickerInput, when I'll get date from API, or whatever.
I didn't find anything about my issue in docs.

inputProps={{disabled: true, readOnly: true }}

works, but not so well, whatever I can click on input, end dayPicker will appear, and I'll be able to change date as normal...

@apalanki

This comment has been minimized.

apalanki commented Apr 5, 2018

DayPickerInput does not take in disabled prop. You could use input box to get past this issue:
disabled ? <input value={}> : <DayPickerInput/>

@gpbl gpbl changed the title from How can I disable DayPickerInput? to Add `disabled` prop Apr 5, 2018

@gpbl gpbl changed the title from Add `disabled` prop to Add disabled prop to DayPickerInput Apr 5, 2018

@gpbl gpbl added v:patch v:minor and removed v:patch labels Apr 5, 2018

@Meloman4eg

This comment has been minimized.

Meloman4eg commented Apr 10, 2018

Hello! I added disabling this way:

import DayPickerInput from 'react-day-picker/DayPickerInput';
import cn from 'classnames';

<DayPickerInput
    inputProps={{
      className: cn(
        'ant-input',
        className,
        {
          'ant-input-disabled': disabled
        }
      ),
      disabled: disabled
    }}
/>

@gpbl gpbl added v:patch and removed v:minor labels Apr 15, 2018

@gpbl gpbl changed the title from Add disabled prop to DayPickerInput to Add support disabled inputs Apr 15, 2018

@gpbl gpbl changed the title from Add support disabled inputs to Add support for disabled inputs Apr 15, 2018

@gpbl

This comment has been minimized.

Owner

gpbl commented Apr 15, 2018

@Meloman4eg adding a className shouldn't solve this issue, as the overlay will appear on click even if the field is marked as disabled. I think I should check the inputProps and disable the click event there.

@gpbl

This comment has been minimized.

Owner

gpbl commented Apr 15, 2018

The support for disabled inputs is on v7.1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment