From 90ac1fa625a7f77bd16dcf02eaca4c562fc8c05c Mon Sep 17 00:00:00 2001 From: Chris Duarte Date: Thu, 23 Feb 2017 09:43:46 -0800 Subject: [PATCH] PLT-5601 RN: autocompleting stopped when non-word chars are typed, even if there's an exact match (#288) --- app/components/autocomplete/at_mention/at_mention.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/autocomplete/at_mention/at_mention.js b/app/components/autocomplete/at_mention/at_mention.js index 7fd4503b2..01dc19b29 100644 --- a/app/components/autocomplete/at_mention/at_mention.js +++ b/app/components/autocomplete/at_mention/at_mention.js @@ -17,7 +17,7 @@ import {makeStyleSheetFromTheme, changeOpacity} from 'app/utils/theme'; import {RequestStatus} from 'service/constants'; -const AT_MENTION_REGEX = /\B@\w*$/i; +const AT_MENTION_REGEX = /\B(@([^@\r\n\s]*))$/i; const getStyleFromTheme = makeStyleSheetFromTheme((theme) => { return StyleSheet.create({ @@ -139,7 +139,7 @@ export default class AtMention extends Component { return; } - const matchTerm = match[0].substring(1); + const matchTerm = match[2]; if (matchTerm !== this.state.matchTerm) { this.setState({