import React, { PropTypes } from 'react';
import { BACK } from './keys';

const Keys = React.createClass({

  propTypes: {
    onBack: PropTypes.func,
  },

  componentDidMount() {
    this.callback = ({ keyCode }) => {
      switch (keyCode) {
        case BACK:
          this.props.onBack();
          break;
        default:
      }
    };
    window.document.addEventListener('keydown', this.callback);
  },

  componentWillUnmount() {
    window.document.removeEventListener('keydown', this.callback);
  },

  render() {
    return <div id="hoc-keys">{this.props.children}</div>;
  },

});

export default Keys;

@@ -48,16 +48,26 @@
 t %7B BACK
+, DOWN, UP
  %7D from 
@@ -76,16 +76,16 @@
 /keys';%0A
-
 %0Aconst K
@@ -154,16 +154,70 @@
 s.func,%0A
+    onDown: PropTypes.func,%0A    onUp: PropTypes.func,%0A
   %7D,%0A%0A  
@@ -321,16 +321,16 @@
 e BACK:%0A
-
         
@@ -369,16 +369,146 @@
  break;%0A
+        case UP:%0A          this.props.onUp();%0A          break;%0A        case DOWN:%0A          this.props.onDown();%0A          break;%0A
         

add UP and DOWN event to Basic