From 184f2824f5a3519b12ca4e683a6c2cbbe20beda2 Mon Sep 17 00:00:00 2001 From: Sam Kelleher Date: Thu, 25 May 2017 16:57:03 +0100 Subject: [PATCH] Do not store recent if recent category is hidden. --- src/components/picker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/picker.js b/src/components/picker.js index a49add6..cba5c4e 100644 --- a/src/components/picker.js +++ b/src/components/picker.js @@ -58,6 +58,8 @@ export default class Picker extends React.Component { allCategories.push(CUSTOM_CATEGORY) } + this.hideRecent = false + if (props.include != undefined) { data.categories.sort((a, b) => { let aName = a.name.toLowerCase() @@ -101,6 +103,7 @@ export default class Picker extends React.Component { let includeRecent = props.include && props.include.length ? props.include.indexOf('recent') > -1 : true let excludeRecent = props.exclude && props.exclude.length ? props.exclude.indexOf('recent') > -1 : false if (includeRecent && !excludeRecent) { + this.hideRecent = true this.categories.unshift(RECENT_CATEGORY) } @@ -163,7 +166,7 @@ export default class Picker extends React.Component { handleEmojiClick(emoji, e) { this.props.onClick(emoji, e) - frequently.add(emoji) + if (!this.hideRecent) frequently.add(emoji) var component = this.refs['category-1'] if (component) {