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

[DatePicker] Call setState-muiTheme in componentWillReceiveProps #2579

Merged
merged 1 commit into from
Dec 18, 2015
Merged

[DatePicker] Call setState-muiTheme in componentWillReceiveProps #2579

merged 1 commit into from
Dec 18, 2015

Conversation

ntgn81
Copy link
Contributor

@ntgn81 ntgn81 commented Dec 18, 2015

DatePicker does not update state.muiTheme on componentWillReceiveProps, resulting in the child component (TextField) not receiving updated theme values.

Side note - would this conditional way of calling this.setState save a few milliseconds of calculation as compared to calling this.setState{muiTheme:...} without any checks like in all other components?

// Taken from flat-button-label.jsx
  componentWillReceiveProps(nextProps, nextContext) {
    let newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
    this.setState({muiTheme: newMuiTheme});
  }

@oliviertassinari
Copy link
Member

Side note - would this conditional way of calling this.setState save a few milliseconds of calculation as compared to calling this.setState{muiTheme:...} without any checks like in all other components?

That's better 👍, but we plan to use an HOC to pass the muiTheme as a property to the components
#2493

oliviertassinari added a commit that referenced this pull request Dec 18, 2015
[DatePicker] Call setState-muiTheme in componentWillReceiveProps
@oliviertassinari oliviertassinari merged commit efcddb2 into mui:master Dec 18, 2015
@oliviertassinari
Copy link
Member

@ntgn81 Thanks!

@zannager zannager added component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! customization: theme Centered around the theming features labels Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! customization: theme Centered around the theming features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants