I have a screen to display news articles. In a news there can be reference to other articles. On clicking on the reference i go to another news detail screen which display the new articles. If have only one reference to another article, it works fine, even go back. But if i have more reference, i always go to the last news article and not to the specific news article i am clicking on. The reference is the "id" of the article, pass via the param of a navigation.push, inside a . Why is it always the last news id that is used ? I put the id (infNum) in the area, and it references the correct id of each article, but it seems that the param idNews is always the last infNum. Here is my code : '''
{news.results.texte.map((content, index) => {
if(content.substring(0,6) === '_Info_') {
{
finNum = content.indexOf("_T_");
finLien = content.indexOf("_/Info_");
infNum = content.substring(6,finNum);
txtLien = content.substring(finNum+3,finLien)
}
//console.log(finNum," ",finLien," ",infNum," ",txtLien)
return (
<TouchableOpacity
style={styles.txtLien}
key={infNum}
onPress={() => {
navigation.push("NewsDetail", {idNews:infNum})}
}
>
<Text>{txtLien}-{infNum}</Text>
</TouchableOpacity>
)
} else {
return (
<Text style={styles.description_text} key={index}>{content}</Text>
)
}
'''