Skip to content
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

TimePicker cannot be controlled input #4719

Closed
YayC opened this issue Jul 15, 2016 · 2 comments
Closed

TimePicker cannot be controlled input #4719

YayC opened this issue Jul 15, 2016 · 2 comments
Labels
component: time picker This is the name of the generic UI component, not the React module!

Comments

@YayC
Copy link

YayC commented Jul 15, 2016

Problem description

TimePicker updates the input field without onChange setting state. I am setting an initial value from the state.

Steps to reproduce

In render:

<TimePicker
  hintText={this.props.timePlaceholder}
  onChange={this.handleTimeChange}
  value={this.state.date}
/>

handleTimeChange:

handleTimeChange = (_nullEvent, date) => {
  console.log(date)
}

Versions

  • Material-UI: 0.15.2
  • React: 15.2.1
  • Browser: latest chrome (51.0.2704.103)
@YayC
Copy link
Author

YayC commented Jul 25, 2016

I just reproduced this issue. I expect the input value not to change for a controlled component unless the state is explicitly changed. With a handler like the one below, it still changes even though state.date does not change:

handleTimeChange = (_nullEvent, date) => {
  console.log(date)
  console.log(this.state.date)
  return null
}

@mpontikes mpontikes mentioned this issue Aug 5, 2016
13 tasks
@oliviertassinari oliviertassinari added component: time picker This is the name of the generic UI component, not the React module! and removed component: time picker This is the name of the generic UI component, not the React module! labels Nov 15, 2016
@oliviertassinari
Copy link
Member

Closing for #4796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: time picker This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

2 participants