Last active
December 24, 2021 04:32
-
-
Save betomoedano/e753ba9a0206416de50415002d6a8833 to your computer and use it in GitHub Desktop.
Displaying data on screen
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
return ( | |
<ScrollView> | |
<Text style={styles.textFriends}>{data.length} Friends</Text> | |
{ | |
data.map((item, index) => { | |
return ( | |
<View key={index} style={styles.itemContainer}> | |
<Image | |
source={{ uri: item.picture.large }} | |
style={styles.image} | |
/> | |
<View> | |
<Text style={styles.textName}>{item.name.first} {item.name.last}</Text> | |
<Text style={styles.textEmail}>{item.login.username}</Text> | |
</View> | |
</View> | |
) | |
}) | |
} | |
</ScrollView> | |
); | |
} | |
export default HomeScreen; | |
const styles = StyleSheet.create({ | |
textFriends: { | |
fontSize: 20, | |
textAlign: 'left', | |
marginLeft: 10, | |
fontWeight: 'bold', | |
marginTop: 10, | |
}, | |
itemContainer: { | |
flexDirection: 'row', | |
alignItems: 'center', | |
marginLeft: 10, | |
marginTop: 10, | |
}, | |
image: { | |
width: 50, | |
height: 50, | |
borderRadius: 25, | |
}, | |
textName: { | |
fontSize: 17, | |
marginLeft: 10, | |
fontWeight: "600", | |
}, | |
textEmail: { | |
fontSize: 14, | |
marginLeft: 10, | |
color: "grey", | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment