Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Create custom material UI input #788

Closed
abdelrahmanahmed opened this issue Sep 7, 2018 · 2 comments
Closed

Create custom material UI input #788

abdelrahmanahmed opened this issue Sep 7, 2018 · 2 comments

Comments

@abdelrahmanahmed
Copy link

abdelrahmanahmed commented Sep 7, 2018

I know that there is a props called component and i can pass my custom component to it , but how i can create custom material UI input, i have tried but it seems that i miss something.

Update : i have created a custom one

class DatePickerCustomInput extends Component {
   render() {
       return (
           <TextField {...this.props}
               InputProps={{
                   startAdornment: (
                       <InputAdornment position="start">
                           <DateRange />
                       </InputAdornment>
                   ),
               }}

               value={this.props.value}
           />
       );
   }
}
 <DayPickerInput
      component={props => <DatePickerCustomInput {...props} />}
      value={toDate}
      placeholder=""
      formatDate={this.setDatePickerformatDate}
      onDayChange={this.handleToDateChange}
  />

but the problem now is happening on onDayChange,it gives and error Uncaught TypeError: Cannot read property 'value' of null

    handleToDateChange = (selectedDay, modifiers, dayPickerInput) => {
        const val = dayPickerInput.getInput().value;
    }

to reproduce the issue : https://codesandbox.io/s/387r9plx65

@abdelrahmanahmed
Copy link
Author

@gpbl i have updated the issue, please check when you are available.

@ShyamRaj
Copy link

I'm having the same issue, Can someone take a look at this?

@gpbl gpbl closed this as completed Feb 10, 2021
Repository owner locked and limited conversation to collaborators Feb 10, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants