Skip to content

Instantly share code, notes, and snippets.

@anchetaWern
Created June 26, 2019 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anchetaWern/1da8057f9529b6cb72c3a3ab1b0c2431 to your computer and use it in GitHub Desktop.
Save anchetaWern/1da8057f9529b6cb72c3a3ab1b0c2431 to your computer and use it in GitHub Desktop.
React Native Stream Chat Profanity Filtering: Add banned to renderUser
renderUser = ({ item }) => {
const online_status = (item.user.online) ? 'online' : 'offline';
return (
<View style={styles.list_item_body}>
<View style={styles.list_item}>
<View style={styles.inline_contents}>
<View style={[styles.status_indicator, styles[online_status]]}></View>
<Text style={styles.list_item_text}>{item.user.name}</Text>
{ // add these:
item.user.warn_count > 2 &&
<View style={styles.banned}>
<Text style={styles.banned_text}>Banned</Text>
</View>
}
</View>
</View>
</View>
);
}
// ...
const styles = StyleSheet.create({
// add these:
banned: {
marginLeft: 10,
backgroundColor: '#cc0000',
padding: 3
},
banned_text: {
color: '#FFF',
fontSize: 12
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment