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

[SelectField] add purerender mixin #1538

Merged
merged 1 commit into from
Sep 24, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/select-field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@ const TextField = require('./text-field');
const DropDownMenu = require('./drop-down-menu');
const DefaultRawTheme = require('./styles/raw-themes/light-raw-theme');
const ThemeManager = require('./styles/theme-manager');
const ContextPure = require('./mixins/context-pure');

const SelectField = React.createClass({

mixins: [StylePropable],
mixins: [
StylePropable,
ContextPure,
],

contextTypes: {
muiTheme: React.PropTypes.object,
},

statics: {
getChildrenClasses() {
return [
TextField,
DropDownMenu,
];
},
},

propTypes: {
errorText: React.PropTypes.string,
floatingLabelText: React.PropTypes.string,
Expand Down Expand Up @@ -68,7 +81,7 @@ const SelectField = React.createClass({
let newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
this.setState({muiTheme: newMuiTheme});
},

getStyles() {
let styles = {
root: {
Expand Down Expand Up @@ -105,15 +118,15 @@ const SelectField = React.createClass({
}
}
else {
styles.error.bottom = -15;
styles.error.bottom = -15;
}

return styles;
},

render() {
let styles = this.getStyles();
let {
const styles = this.getStyles();
const {
style,
labelStyle,
iconStyle,
Expand All @@ -130,7 +143,7 @@ const SelectField = React.createClass({
...other,
} = this.props;

let textFieldProps = {
const textFieldProps = {
style: this.mergeAndPrefix(styles.input, style),
floatingLabelText: floatingLabelText,
floatingLabelStyle: floatingLabelStyle,
Expand All @@ -139,7 +152,7 @@ const SelectField = React.createClass({
errorText: errorText,
errorStyle: this.mergeAndPrefix(styles.error, errorStyle),
};
let dropDownMenuProps = {
const dropDownMenuProps = {
menuItems: menuItems,
disabled: disabled,
style: this.mergeAndPrefix(styles.root, selectFieldRoot),
Expand Down