I am having an issue where I am trying to map through some links and display the text 'added' if it matches a ID in my data, however I am not receiving the text. The code is below:
export default function({username, links, navigation}) {
<FlatList
removeClippedSubviews={false}
keyboardShouldPersistTaps='handled'
contentContainerStyle=
data={AddlinksData}
keyExtractor={item => item.key}
renderItem={({item}) => {
return (
<>
<View style={styles.item}>
{/* Heading */}
<View>
<Text style=>
{item.iconName}
</Text>
<Text style={styles.description}>{item.link}</Text>
{/* Map through links, and if linkid and my item id match, display that
is added */}
{links.map((linkContent) => {
linkContent.linkId===item.id ?
<Text style={styles.description}>Added</Text>
: <Text style={styles.description}>Not Added</Text>
})}
</View>
</View>
</>
)
}}
/>
}
I am not sure why nothing is returning from the map function, because when I execute this code instead:
{/* Map through links, and if linkid and my item id match, display that
is added */}
{links.map((linkContent) => {
linkContent.linkId===item.id ?
console.log('test')
: <Text style={styles.description}>Not Added</Text>
})}
I receive test in the console log so it seems to be working. Any help would be appreciate, thank you in advance
Aucun commentaire:
Enregistrer un commentaire