-
-
Save kasprownik/2768859ef3b724754586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/components/Text.js | |
import React, { PropTypes } from 'react'; | |
import TextField from 'material-ui/lib/text-field'; | |
import * as validators from '../validators'; | |
export default React.createClass({ | |
//... | |
contextTypes: { | |
update: PropTypes.func.isRequired, | |
values: PropTypes.object.isRequired, | |
registerValidation: PropTypes.func.isRequired | |
}, | |
componentWillMount() { | |
this.removeValidationFromContext = this.context.registerValidation(show => | |
this.isValid(show)); | |
}, | |
componentWillUnmount() { | |
this.removeValidationFromContext(); | |
}, | |
//... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment