RN-465 Fixed emoji autocomplete removing spaces before emoji (#1150)
This commit is contained in:
parent
002a5b8acd
commit
e98e22600e
1 changed files with 2 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import Emoji from 'app/components/emoji';
|
|||
import {makeStyleSheetFromTheme, changeOpacity} from 'app/utils/theme';
|
||||
|
||||
const EMOJI_REGEX = /(^|\s|^\+|^-)(:([^:\s]*))$/i;
|
||||
const EMOJI_REGEX_WITHOUT_PREFIX = /\B(:([^:\s]*))$/i;
|
||||
|
||||
export default class EmojiSuggestion extends Component {
|
||||
static propTypes = {
|
||||
|
|
@ -81,7 +82,7 @@ export default class EmojiSuggestion extends Component {
|
|||
actions.addReactionToLatestPost(emoji, rootId);
|
||||
onChangeText('');
|
||||
} else {
|
||||
let completedDraft = emojiPart.replace(EMOJI_REGEX, `:${emoji}: `);
|
||||
let completedDraft = emojiPart.replace(EMOJI_REGEX_WITHOUT_PREFIX, `:${emoji}: `);
|
||||
|
||||
if (value.length > cursorPosition) {
|
||||
completedDraft += value.substring(cursorPosition);
|
||||
|
|
|
|||
Loading…
Reference in a new issue