You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -115,13 +105,13 @@ class ResetPasswordForm extends React.Component {
115
105
});
116
106
}
117
107
118
-
handleChange(event) {
108
+
handleChange=(event)=> {
119
109
const { user } =this.state;
120
110
user[event.target.name] =event.target.value;
121
111
this.setState({ user });
122
112
}
123
113
124
-
handleSubmit() {
114
+
handleSubmit= () => {
125
115
// your submit logic
126
116
}
127
117
@@ -133,7 +123,7 @@ class ResetPasswordForm extends React.Component {
133
123
onSubmit={this.handleSubmit}
134
124
>
135
125
<TextValidator
136
-
floatingLabelText="Password"
126
+
label="Password"
137
127
onChange={this.handleChange}
138
128
name="password"
139
129
type="password"
@@ -142,15 +132,15 @@ class ResetPasswordForm extends React.Component {
142
132
value={user.password}
143
133
/>
144
134
<TextValidator
145
-
floatingLabelText="Repeat password"
135
+
label="Repeat password"
146
136
onChange={this.handleChange}
147
137
name="repeatPassword"
148
138
type="password"
149
139
validators={['isPasswordMatch', 'required']}
150
140
errorMessages={['password mismatch', 'this field is required']}
151
141
value={user.repeatPassword}
152
142
/>
153
-
<RaisedButton type="submit"/>
143
+
<Button type="submit">Submit</Button>
154
144
</ValidatorForm>
155
145
);
156
146
}
@@ -160,10 +150,20 @@ class ResetPasswordForm extends React.Component {
160
150
Currently material-ui [doesn't support](https://github.com/callemall/material-ui/issues/3771) error messages for switches, but you can easily add your own:
161
151
````javascript
162
152
import React from 'react';
163
-
import { red300 } from 'material-ui/styles/colors';
164
-
import Checkbox from 'material-ui/Checkbox';
153
+
import red from '@material-ui/core/colors/red';
154
+
import Checkbox from '@material-ui/core/Checkbox';
165
155
import { ValidatorComponent } from 'react-material-ui-form-validator';
166
156
157
+
const red300 = red['500'];
158
+
159
+
const style = {
160
+
right: 0,
161
+
fontSize: '12px',
162
+
color: red300,
163
+
position: 'absolute',
164
+
marginTop: '-25px',
165
+
};
166
+
167
167
class CheckboxValidatorElement extends ValidatorComponent {
168
168
169
169
render() {
@@ -187,14 +187,6 @@ class CheckboxValidatorElement extends ValidatorComponent {
187
187
return null;
188
188
}
189
189
190
-
const style = {
191
-
right: 0,
192
-
fontSize: '12px',
193
-
color: red300,
194
-
position: 'absolute',
195
-
marginTop: '-25px',
196
-
};
197
-
198
190
return (
199
191
<div style={style}>
200
192
{this.getErrorMessage()}
@@ -206,7 +198,7 @@ class CheckboxValidatorElement extends ValidatorComponent {
206
198
export default CheckboxValidatorElement;
207
199
````
208
200
````javascript
209
-
componentWillMount() {
201
+
componentDidMount() {
210
202
ValidatorForm.addValidationRule('isTruthy', value => value);
0 commit comments