Skip to content

Commit

Permalink
Use onClickOutside HOC instead of mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgio committed Apr 16, 2016
1 parent 396790c commit 048be70
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/Token.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {findDOMNode} from 'react-dom';

import cx from 'classnames';
import keyCode from './keyCode';
import onClickOutside from 'react-onclickoutside';
import listensToClickOutside from 'react-onclickoutside/decorator';

require('../css/Token.css');

Expand All @@ -18,8 +18,6 @@ require('../css/Token.css');
const Token = React.createClass({
displayName: 'Token',

mixins: [onClickOutside],

propTypes: {
/**
* Handler for removing/deleting the token. If not defined, the token will
Expand Down Expand Up @@ -113,4 +111,4 @@ const Token = React.createClass({
},
});

export default Token;
export default listensToClickOutside(Token);
6 changes: 2 additions & 4 deletions src/Typeahead.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import TypeaheadMenu from './TypeaheadMenu.react';

import {find, head, isEmpty, isEqual, uniqueId} from 'lodash';
import {BACKSPACE, DOWN, ESC, RETURN, TAB, UP} from './keyCode';
import onClickOutside from 'react-onclickoutside';
import listensToClickOutside from 'react-onclickoutside/decorator';

require('../css/Typeahead.css');

Expand All @@ -18,8 +18,6 @@ require('../css/Typeahead.css');
const Typeahead = React.createClass({
displayName: 'Typeahead',

mixins: [onClickOutside],

propTypes: {
/**
* Allows the creation of new selections on the fly. Note that any new items
Expand Down Expand Up @@ -321,4 +319,4 @@ const Typeahead = React.createClass({
},
});

export default Typeahead;
export default listensToClickOutside(Typeahead);
6 changes: 2 additions & 4 deletions src/TypeaheadInput.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {PropTypes} from 'react';
import cx from 'classnames';
import {head} from 'lodash';
import keyCode from './keyCode';
import onClickOutside from 'react-onclickoutside';
import listensToClickOutside from 'react-onclickoutside/decorator';

/**
* TypeaheadInput
Expand All @@ -15,8 +15,6 @@ import onClickOutside from 'react-onclickoutside';
const TypeaheadInput = React.createClass({
displayName: 'TypeaheadInput',

mixins: [onClickOutside],

propTypes: {
disabled: PropTypes.bool,
filteredOptions: PropTypes.array,
Expand Down Expand Up @@ -127,4 +125,4 @@ const TypeaheadInput = React.createClass({
},
});

export default TypeaheadInput;
export default listensToClickOutside(TypeaheadInput);

0 comments on commit 048be70

Please sign in to comment.