0

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

2 Answers 2

2

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);
Sign up to request clarification or add additional context in comments.

Comments

0

You can pass the url like this

<ImageViewer imageUrls={imagess[0].url}/></View>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.