I have an array of urls like that:
[ "https://hey.com",
"https://yes.com",
"https://wow.com",
/..
]
I have the same icon but multiple times. I want each of them to redirect to its specific url when on pressed.
I tried this code but it's not working:
onPress=(arrayOfURL)=>{
for (i in arrayOfURL)
{
this.setState({ browserOpen: true });
WebBrowser.openBrowserAsync(JSON.stringify(arrayOfURL[i]))
.then(() => {
WebBrowser.dismissBrowser();
this.setState({ browserOpen: false });
});
}
}
The code for the icon:
<View >
<Icon
name='sc-telegram'
type='evilicon'
color='black'
onPress={this.onPress} />
</View>