Merge pull request #53 from madshargreave/master
Added `include` and `exclude` props to filter emoji categoriesrelease
commit
b4f39a2730
|
@ -22,6 +22,8 @@ import { Picker } from 'emoji-mart'
|
|||
| ---- | :------: | ------- | ----------- |
|
||||
| **color** | | `#ae65c5` | The top bar anchors select and hover color |
|
||||
| **emoji** | | `department_store` | The emoji shown when no emojis are hovered |
|
||||
| **include** | | `['People', 'Flags']` | Only load included categories |
|
||||
| **exclude** | | `['Animals', 'Objects']` | Don't load excluded catagories |
|
||||
| **emojiSize** | | `24` | The emoji width and height |
|
||||
| **onClick** | | | Params: `(emoji, event) => {}` |
|
||||
| **perLine** | | `9` | Number of emojis per line. While there’s no minimum or maximum, this will affect the picker’s width. This will set *Frequently Used* length as well (`perLine * 4`) |
|
||||
|
|
|
@ -43,6 +43,10 @@ export default class Picker extends React.Component {
|
|||
let filteredCategories = [];
|
||||
|
||||
for (let hash of data.categories) {
|
||||
let isIncluded = props.include == undefined ? true : props.include.indexOf(hash.name) > -1
|
||||
let isExcluded = props.exclude == undefined ? false : props.exclude.indexOf(hash.name) > -1
|
||||
if (!isIncluded || isExcluded) { continue; }
|
||||
|
||||
let new_emojis = [];
|
||||
for (let emoji of hash.emojis) {
|
||||
let unified = data.emojis[emoji].unified;
|
||||
|
@ -348,6 +352,8 @@ Picker.propTypes = {
|
|||
backgroundImageFn: Emoji.propTypes.backgroundImageFn,
|
||||
sheetSize: Emoji.propTypes.sheetSize,
|
||||
emojisToShowFilter: React.PropTypes.func,
|
||||
include: React.PropTypes.arrayOf(React.PropTypes.string),
|
||||
exclude: React.PropTypes.arrayOf(React.PropTypes.string)
|
||||
}
|
||||
|
||||
Picker.defaultProps = {
|
||||
|
|
Loading…
Reference in New Issue