Use emoji object in `emojisToShowFilter`

So that custom emojis can also be filtered if need be
nolan/hinaloe-test
Etienne Lemay 2017-05-27 13:26:02 -04:00
parent e95f515268
commit 98f2a95913
2 changed files with 2 additions and 4 deletions

View File

@ -38,7 +38,7 @@ import { Picker } from 'emoji-mart'
| **set** | | `apple` | The emoji set: `'apple', 'google', 'twitter', 'emojione'` |
| **sheetSize** | | `64` | The emoji [sheet size](#sheet-sizes): `16, 20, 32, 64` |
| **backgroundImageFn** | | ```((set, sheetSize) => …)``` | A Fn that returns that image sheet to use for emojis. Useful for avoiding a request if you have the sheet locally. |
| **emojisToShowFilter** | | ```((unicode) => true)``` | A Fn to choose whether an emoji should be displayed or not based on its unicode |
| **emojisToShowFilter** | | ```((emoji) => true)``` | A Fn to choose whether an emoji should be displayed or not |
| **skin** | | `1` | Default skin color: `1, 2, 3, 4, 5, 6` |
| **style** | | | Inline styles applied to the root element. Useful for positioning |
| **title** | | `Emoji Mart™` | The title shown when no emojis are hovered |

View File

@ -80,9 +80,7 @@ export default class Picker extends React.Component {
let newEmojis = []
for (let emoji of category.emojis) {
let unified = data.emojis[emoji].unified
if (props.emojisToShowFilter(unified)) {
if (props.emojisToShowFilter(data.emojis[emoji] || emoji)) {
newEmojis.push(emoji)
}
}