Created
June 26, 2019 06:09
-
-
Save anchetaWern/1da8057f9529b6cb72c3a3ab1b0c2431 to your computer and use it in GitHub Desktop.
React Native Stream Chat Profanity Filtering: Add banned to renderUser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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