adds functionality to disable the frequent emoji sorting, updates storybook for visibility
parent
769b55c875
commit
cdb6c26a08
|
@ -289,7 +289,9 @@ export default class NimblePicker extends React.PureComponent {
|
||||||
var component = this.categoryRefs['category-1']
|
var component = this.categoryRefs['category-1']
|
||||||
if (component) {
|
if (component) {
|
||||||
let maxMargin = component.maxMargin
|
let maxMargin = component.maxMargin
|
||||||
|
if (!this.props.disableFrequentEmojiSort){
|
||||||
component.forceUpdate()
|
component.forceUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (!this.scroll) return
|
if (!this.scroll) return
|
||||||
|
@ -523,6 +525,7 @@ export default class NimblePicker extends React.PureComponent {
|
||||||
exclude,
|
exclude,
|
||||||
recent,
|
recent,
|
||||||
autoFocus,
|
autoFocus,
|
||||||
|
disableFrequentEmojiSort,
|
||||||
skinEmoji,
|
skinEmoji,
|
||||||
notFound,
|
notFound,
|
||||||
notFoundEmoji,
|
notFoundEmoji,
|
||||||
|
|
|
@ -37,6 +37,7 @@ const PickerDefaultProps = {
|
||||||
),
|
),
|
||||||
emojiTooltip: EmojiDefaultProps.tooltip,
|
emojiTooltip: EmojiDefaultProps.tooltip,
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
|
disableFrequentEmojiSort: false,
|
||||||
custom: [],
|
custom: [],
|
||||||
skinEmoji: '',
|
skinEmoji: '',
|
||||||
notFound: () => {},
|
notFound: () => {},
|
||||||
|
|
|
@ -43,6 +43,7 @@ const PickerPropTypes = {
|
||||||
exclude: PropTypes.arrayOf(PropTypes.string),
|
exclude: PropTypes.arrayOf(PropTypes.string),
|
||||||
recent: PropTypes.arrayOf(PropTypes.string),
|
recent: PropTypes.arrayOf(PropTypes.string),
|
||||||
autoFocus: PropTypes.bool,
|
autoFocus: PropTypes.bool,
|
||||||
|
disableFrequentEmojiSort: PropTypes.bool,
|
||||||
custom: PropTypes.arrayOf(
|
custom: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -74,6 +74,28 @@ storiesOf('Picker', module)
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
|
||||||
|
.add('Pause Frequent Emoji Sort', () => (
|
||||||
|
<Picker
|
||||||
|
disableFrequentEmojiSort={boolean('Unicode', true)}
|
||||||
|
onClick={action('clicked')}
|
||||||
|
onSelect={action('selected')}
|
||||||
|
onSkinChange={action('skin changed')}
|
||||||
|
native={boolean('Unicode', true)}
|
||||||
|
darkMode={boolean('Dark mode', false)}
|
||||||
|
set={select('Emoji pack', SETS, SETS[0])}
|
||||||
|
emojiSize={number('Emoji size', 24)}
|
||||||
|
perLine={number('Per line', 9)}
|
||||||
|
title={text('Idle text', 'Your Title Here')}
|
||||||
|
emoji={text('Idle emoji', 'department_store')}
|
||||||
|
notFoundEmoji={text('Not found emoji', 'sleuth_or_spy')}
|
||||||
|
defaultSkin={number('Default skin tone', 1)}
|
||||||
|
color={color('Highlight color', '#ae65c5')}
|
||||||
|
showPreview={boolean('Show preview', true)}
|
||||||
|
showSkinTones={boolean('Show skin tones', true)}
|
||||||
|
custom={CUSTOM_EMOJIS}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
|
||||||
.add('Custom category icons', () => (
|
.add('Custom category icons', () => (
|
||||||
<Picker
|
<Picker
|
||||||
custom={CUSTOM_EMOJIS}
|
custom={CUSTOM_EMOJIS}
|
||||||
|
|
Loading…
Reference in New Issue