Merge pull request #417 from SaraRandolph/sara.randolph/enhancement/disable_frequent_emoji_sort

enhancement: functionality to disable the frequent emoji sorting
release
Etienne Lemay 2020-03-16 11:11:54 -04:00 committed by GitHub
commit b8fad36c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 1 deletions

View File

@ -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.enableFrequentEmojiSort) {
component.forceUpdate() component.forceUpdate()
}
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (!this.scroll) return if (!this.scroll) return

View File

@ -37,6 +37,7 @@ const PickerDefaultProps = {
), ),
emojiTooltip: EmojiDefaultProps.tooltip, emojiTooltip: EmojiDefaultProps.tooltip,
autoFocus: false, autoFocus: false,
enableFrequentEmojiSort: false,
custom: [], custom: [],
skinEmoji: '', skinEmoji: '',
notFound: () => {}, notFound: () => {},

View File

@ -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,
enableFrequentEmojiSort: PropTypes.bool,
custom: PropTypes.arrayOf( custom: PropTypes.arrayOf(
PropTypes.shape({ PropTypes.shape({
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,

View File

@ -56,6 +56,7 @@ storiesOf('Picker', module)
color={color('Highlight color', '#ae65c5')} color={color('Highlight color', '#ae65c5')}
showPreview={boolean('Show preview', true)} showPreview={boolean('Show preview', true)}
showSkinTones={boolean('Show skin tones', true)} showSkinTones={boolean('Show skin tones', true)}
enableFrequentEmojiSort={boolean('Enable frequent sort', false)}
custom={CUSTOM_EMOJIS} custom={CUSTOM_EMOJIS}
/> />
)) ))