Skip to content

Commit

Permalink
2.0.2 - [PATCH][BUGFIX] add onClick handler to emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Jan 27, 2018
1 parent dd81623 commit ca65608
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 23 deletions.
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/universal/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/universal/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "emoji-picker-react",
"version": "2.0.1",
"version": "2.0.2",
"description": "React emoji-picker component",
"main": "./dist/index.js",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/DiversityPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ function DiversityPicker({ index, assetPath, emojiResolution, onEmojiClick, clos
let diversities = null;

function onClick(diversity, e) {
e.preventDefault();
onEmojiClick(diversity, emoji, e);
close();
setTimeout(close, 500);
}

if (emoji && emoji.diversities) {
Expand All @@ -35,7 +34,7 @@ function DiversityPicker({ index, assetPath, emojiResolution, onEmojiClick, clos
key={diversity}
style={style}
className="emoji"
onMouseDown={((e) => onClick(diversity, e))}/>
onClick={((e) => onClick(diversity, e))}/>
);
})
}</div>
Expand Down
10 changes: 8 additions & 2 deletions src/Emoji/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Emoji extends Component {
this.hasDiversities = this.emoji.hasOwnProperty('diversities');

this.onClick = this.onClick.bind(this);
this.emojiChosen = this.emojiChosen.bind(this);
this.onMouseEnter = this.onMouseEnter.bind(this);
this.onMouseLeave = this.onMouseLeave.bind(this);
this.onMouseDown = this.onMouseDown.bind(this);
Expand All @@ -30,6 +31,10 @@ class Emoji extends Component {
}

onClick(e) {
e.preventDefault();
}

emojiChosen(e) {
const { emoji } = this.props;
const onEmojiClick = this.context.onEmojiClick;

Expand Down Expand Up @@ -88,7 +93,7 @@ class Emoji extends Component {
delete this.timeCounter;

if (!(counter && (Date.now() - counter) >= OPEN_DIVERSITIES_TIMEOUT)) {
return this.onClick(e);
return this.emojiChosen(e);
}
}

Expand All @@ -108,6 +113,7 @@ class Emoji extends Component {
return (
<a href="#!"
className={className}
onClick={this.onClick}
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}
onMouseDown={this.onMouseDown}
Expand All @@ -134,7 +140,7 @@ Emoji.contextTypes = {
activeModifier: PropTypes.string,
emojiResolution: PropTypes.number,
openDiversitiesMenu: PropTypes.func,
disableDiversityPicker: PropTypes.bool,
disableDiversityPicker: PropTypes.bool
};

export default Emoji;
6 changes: 2 additions & 4 deletions src/EmojiPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class EmojiPicker extends Component {
}

getChildContext() {
const { assetPath, emojiResolution, disableDiversityPicker, customCategoryNames, emojiSize, emojiPadding} = this.props;
const { assetPath, emojiResolution, disableDiversityPicker, customCategoryNames} = this.props;
const { activeModifier } = this.state;
const { openDiversitiesMenu } = this;
return { onEmojiClick: this.onEmojiClick, parent: this, assetPath, activeModifier, emojiResolution, openDiversitiesMenu, disableDiversityPicker, customCategoryNames };
Expand Down Expand Up @@ -243,9 +243,7 @@ EmojiPicker.propTypes = {
emojiResolution: PropTypes.number,
preload: PropTypes.bool,
customCategoryNames: PropTypes.object,
disableDiversityPicker: PropTypes.bool,
emojiSize: PropTypes.number,
emojiPadding: PropTypes.number
disableDiversityPicker: PropTypes.bool
};

EmojiPicker.childContextTypes = {
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2462,9 +2462,9 @@ doctrine@^2.0.0:
esutils "^2.0.2"
isarray "^1.0.0"

doctrine@^2.0.2:
version "2.0.2"
resolved "https://registry.npmjs.org/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075"
doctrine@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
dependencies:
esutils "^2.0.2"

Expand Down Expand Up @@ -2817,17 +2817,17 @@ eslint-visitor-keys@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"

eslint@4.15.0:
version "4.15.0"
resolved "https://registry.npmjs.org/eslint/-/eslint-4.15.0.tgz#89ab38c12713eec3d13afac14e4a89e75ef08145"
eslint@4.16.0:
version "4.16.0"
resolved "https://registry.npmjs.org/eslint/-/eslint-4.16.0.tgz#934ada9e98715e1d7bbfd6f6f0519ed2fab35cc1"
dependencies:
ajv "^5.3.0"
babel-code-frame "^6.22.0"
chalk "^2.1.0"
concat-stream "^1.6.0"
cross-spawn "^5.1.0"
debug "^3.1.0"
doctrine "^2.0.2"
doctrine "^2.1.0"
eslint-scope "^3.7.1"
eslint-visitor-keys "^1.0.0"
espree "^3.5.2"
Expand Down

0 comments on commit ca65608

Please sign in to comment.