Skip to content

Instantly share code, notes, and snippets.

@AndrewIngram
Created October 7, 2014 11:20
Show Gist options
  • Save AndrewIngram/23ae881f7d6a260cfbe4 to your computer and use it in GitHub Desktop.
Save AndrewIngram/23ae881f7d6a260cfbe4 to your computer and use it in GitHub Desktop.
var React = require('react');
var KeyboardMixin = {
propTypes: {
keyboard: React.PropTypes.object
},
contextTypes: {
keyboard: React.PropTypes.object
},
childContextTypes: {
keyboard: React.PropTypes.object
},
getChildContext: function() {
return {
keyboard: this.getKeyboard()
};
},
getKeyboard: function() {
return this.props.keyboard || this.context.keyboard;
}
};
module.exports = KeyboardMixin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment