Add “Frequently Used” support to custom emojis
parent
e28dc4da55
commit
e95f515268
|
@ -72,10 +72,19 @@ export default class Category extends React.Component {
|
|||
var { name, emojis, perLine } = this.props
|
||||
|
||||
if (name == 'Recent') {
|
||||
let { custom } = this.props
|
||||
let frequentlyUsed = frequently.get(perLine)
|
||||
|
||||
if (frequentlyUsed.length) {
|
||||
emojis = frequentlyUsed
|
||||
emojis = frequentlyUsed.map((id) => {
|
||||
for (let emoji of custom) {
|
||||
if (emoji.id === id) {
|
||||
return emoji
|
||||
}
|
||||
}
|
||||
|
||||
return id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { Anchors, Category, Emoji, Preview, Search } from '.'
|
|||
|
||||
const RECENT_CATEGORY = { name: 'Recent', emojis: null }
|
||||
const SEARCH_CATEGORY = { name: 'Search', emojis: null, anchor: false }
|
||||
const CUSTOM_CATEGORY = { name: 'Custom', emojis: null }
|
||||
const CUSTOM_CATEGORY = { name: 'Custom', emojis: [] }
|
||||
|
||||
const I18N = {
|
||||
search: 'Search',
|
||||
|
@ -357,6 +357,7 @@ export default class Picker extends React.Component {
|
|||
native={native}
|
||||
hasStickyPosition={this.hasStickyPosition}
|
||||
i18n={this.i18n}
|
||||
custom={category.name == 'Recent' ? CUSTOM_CATEGORY.emojis : undefined}
|
||||
emojiProps={{
|
||||
native: native,
|
||||
skin: skin,
|
||||
|
|
Loading…
Reference in New Issue