[REGRESSION] Remove @ and # from mention (#1721)

This commit is contained in:
Diego Mello 2020-02-13 21:22:53 -03:00 committed by GitHub
parent 88c0ba6aff
commit 400d33250d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 19 deletions

View File

@ -4723,7 +4723,7 @@ exports[`Storyshots Message list message 1`] = `
] ]
} }
> >
@rocket.cat rocket.cat
</Text> </Text>
<Text <Text
numberOfLines={0} numberOfLines={0}
@ -4766,7 +4766,7 @@ exports[`Storyshots Message list message 1`] = `
] ]
} }
> >
@diego.mello diego.mello
</Text> </Text>
<Text <Text
numberOfLines={0} numberOfLines={0}
@ -4809,7 +4809,7 @@ exports[`Storyshots Message list message 1`] = `
] ]
} }
> >
@all all
</Text> </Text>
<Text <Text
numberOfLines={0} numberOfLines={0}
@ -4852,7 +4852,7 @@ exports[`Storyshots Message list message 1`] = `
] ]
} }
> >
@here here
</Text> </Text>
<Text <Text
numberOfLines={0} numberOfLines={0}
@ -4895,7 +4895,7 @@ exports[`Storyshots Message list message 1`] = `
] ]
} }
> >
#general general
</Text> </Text>
</Text> </Text>
</View> </View>

View File

@ -28,21 +28,27 @@ const AtMention = React.memo(({
} }
const handlePress = () => { const handlePress = () => {
if (mentions && mentions.length && mentions.findIndex(m => m.username === mention) !== -1) {
const index = mentions.findIndex(m => m.username === mention); const index = mentions.findIndex(m => m.username === mention);
const navParam = { const navParam = {
t: 'd', t: 'd',
rid: mentions[index]._id rid: mentions[index]._id
}; };
navToRoomInfo(navParam); navToRoomInfo(navParam);
}
}; };
if (mentions && mentions.length && mentions.findIndex(m => m.username === mention) !== -1) {
return ( return (
<Text <Text
style={[preview ? { ...styles.text, color: themes[theme].bodyText } : mentionStyle, ...style]} style={[preview ? { ...styles.text, color: themes[theme].bodyText } : mentionStyle, ...style]}
onPress={preview ? undefined : handlePress} onPress={preview ? undefined : handlePress}
> >
{mention}
</Text>
);
}
return (
<Text style={[styles.text, { color: themes[theme].bodyText }, ...style]}>
{`@${ mention }`} {`@${ mention }`}
</Text> </Text>
); );

View File

@ -24,12 +24,12 @@ const Hashtag = React.memo(({
style={[preview ? { ...styles.text, color: themes[theme].bodyText } : styles.mention, ...style]} style={[preview ? { ...styles.text, color: themes[theme].bodyText } : styles.mention, ...style]}
onPress={preview ? undefined : handlePress} onPress={preview ? undefined : handlePress}
> >
{`#${ hashtag }`} {hashtag}
</Text> </Text>
); );
} }
return ( return (
<Text style={[preview ? { ...styles.text, color: themes[theme].bodyText } : styles.mention, ...style]}> <Text style={[styles.text, { color: themes[theme].bodyText }, ...style]}>
{`#${ hashtag }`} {`#${ hashtag }`}
</Text> </Text>
); );