diff --git a/app/components/autocomplete/emoji_suggestion/__snapshots__/emoji_suggestion.test.js.snap b/app/components/autocomplete/emoji_suggestion/__snapshots__/emoji_suggestion.test.js.snap index 9d6be4bd6..f277ee24c 100644 --- a/app/components/autocomplete/emoji_suggestion/__snapshots__/emoji_suggestion.test.js.snap +++ b/app/components/autocomplete/emoji_suggestion/__snapshots__/emoji_suggestion.test.js.snap @@ -1,6 +1,45 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`components/autocomplete/emoji_suggestion should match snapshot 1`] = `null`; +exports[`components/autocomplete/emoji_suggestion should match snapshot 1`] = ` + +`; exports[`components/autocomplete/emoji_suggestion should match snapshot 2`] = ` { - const {emojis, fuse} = this.props; + const {emojis} = this.props; let sorter = compareEmojis; if (searchTerm.trim().length) { @@ -198,18 +216,23 @@ export default class EmojiSuggestion extends PureComponent { render() { const {maxListHeight, theme, nestedScrollEnabled} = this.props; + let height; if (!this.state.active) { - // If we are not in an active state return null so nothing is rendered - // other components are not blocked. - return null; + // If we are not in an active state set a height of 0 so nothing is rendered + // and other components are not blocked. + height = 0; + if (this.listRef.current) { + this.listRef.current.scrollToOffset({offset: 0}); + } } const style = getStyleFromTheme(theme); return ( { }, }; const emojis = selectEmojisByName(state); - const options = { - shouldSort: false, - threshold: 0.3, - location: 0, - distance: 10, - includeMatches: true, - findAllMatches: true, - }; - const fuse = new Fuse(emojis, options); const baseProps = { actions: { addReactionToLatestPost: jest.fn(), @@ -38,7 +28,6 @@ describe('components/autocomplete/emoji_suggestion', () => { cursorPosition: 0, customEmojisEnabled: false, emojis, - fuse, isSearch: false, theme: Preferences.THEMES.default, onChangeText: jest.fn(), diff --git a/app/components/autocomplete/emoji_suggestion/index.js b/app/components/autocomplete/emoji_suggestion/index.js index f490b3d3b..881ae4a8d 100644 --- a/app/components/autocomplete/emoji_suggestion/index.js +++ b/app/components/autocomplete/emoji_suggestion/index.js @@ -3,7 +3,6 @@ import {connect} from 'react-redux'; import {bindActionCreators} from 'redux'; -import Fuse from 'fuse.js'; import {addReactionToLatestPost} from '@actions/views/emoji'; import {autocompleteCustomEmojis} from '@mm-redux/actions/emojis'; @@ -15,20 +14,8 @@ import EmojiSuggestion from './emoji_suggestion'; function mapStateToProps(state) { const emojis = selectEmojisByName(state); - const options = { - shouldSort: false, - threshold: 0.3, - location: 0, - distance: 10, - includeMatches: true, - findAllMatches: true, - }; - - const list = emojis.length ? emojis : []; - const fuse = new Fuse(list, options); return { - fuse, emojis, customEmojisEnabled: getConfig(state).EnableCustomEmoji === 'true', theme: getTheme(state),