Created
June 23, 2022 08:31
-
-
Save socialwell-demos/6b52bcdb0893534756587c94d3811ce3 to your computer and use it in GitHub Desktop.
React Native render list example using react.js
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
const renderUsersItem = ({ item }) => { | |
if (!item) { | |
return null; | |
} | |
const handlerLongClick = (id) => { | |
console.log(id) | |
} | |
const [first, last] = item.name.split(' '); | |
return ( | |
<TouchableOpacity | |
style={[styles.userListWrapper, { backgroundColor: '#fff' }]} | |
onLongPress={() => handlerLongClick(item.id)} | |
onPress={() => { }}> | |
<View style={styles.avatarContainer}> | |
<Avatar.Text | |
size={40} | |
label={[first[0], last[0]]} | |
style={{backgroundColor: '#285e61', fontSize: 20}} | |
/> | |
</View> | |
<View style={styles.userColumnData}> | |
<Text style={styles.columnText}>{item.name}</Text> | |
<Text style={styles.columnTextLight} >{item.gender}</Text> | |
</View> | |
<View style={styles.userColumnData}> | |
<Text style={styles.columnText}>{item.address}</Text> | |
<Text style={styles.columnText}>{item.country}</Text> | |
</View> | |
<View style={styles.userColumnData}> | |
<Text style={styles.columnText}>{item.mobileNo}</Text> | |
<Text style={styles.columnText}>{item.email}</Text> | |
</View> | |
<View style={styles.userColumnData}> | |
<Text style={styles.design}>{item.tag}</Text> | |
</View> | |
</TouchableOpacity> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment