Reputation: 1316
I am a noob. I am developing a react native app. In that, I have a collection of URLs inside this
'this.props.navigation.state.params.PassedURL'
I want to pass all the URLs inside that to the following array.
imagess: [{
url: '',
}],
this is because I am using a package 'react-native-image-zoom-viewer' which only supports this type of array, like this.
<ImageViewer imageUrls={imagess}/></View>
how can we this
Upvotes: 0
Views: 680
Reputation: 1940
Push data in the array
var images = []; --create an array--
var imageUrl = 'https://myimageurl.com'; --define your image url--
var tempData = '{url:'+ imageUrl +'}'; --create data to be pushed in array--
images.push(tempData) -- Push the data to array--
Now you have collection of urls so put them one by one using loop
var images = [];
for(i=0; i< url.object.length; i++);
var imageUrl = url.object.length[0].url;
var tempData = '{url:'+ imageUrl +'}';
images.push(tempData);
Upvotes: 2
Reputation: 758
You can pass the url like this
<ImageViewer imageUrls={imagess[0].url}/></View>
Upvotes: 0