How do I display all of the images from my Firebase Storage in React Native without needing image names?

Uchiha Alchemist

Hello i am trying to figure out how to display all of the images in a folder i have in Firebase Storage called "VerifiedPhotos". I don't want to reference them by image name like I did below because I have multiple images. How do I grab all the list of image URLS and display them to my screen in React Native? Please help I have spent all week looking up how to use listAll() and I also am not sure how to display the multiple images in the return statement. Please help.

  const Photos = () => {
  const [imageUrl, setImageUrl] = useState(undefined);

  useEffect(() => {
      firebase.storage()
        .ref('VerifiedPhotos/' + '3.png') //name in storage in firebase console
        .getDownloadURL()
        .then((url) => {
          setImageUrl(url);
        })
        .catch((e) => console.log('Errors while downloading => ', e));
    }, []);
  
  return (
      <Image style={{height: 200, width: 200}} source={{uri: imageUrl}} />
  );
}

export default Photos;
Victor Bls

As the documentation said about .listAll() here, you need to iterate through results :

const Photos = () => {
  const [imageTab, setImageTab] = useState([]);

  useEffect(() => {
    firebase.storage()
      .ref('VerifiedPhotos/')
      .listAll()
      .then(function(result) {
          result.items.forEach(function(imageRef) {
              imageRef.getDownloadURL().then(function(url) {
                  imageTab.push(url);
                  setImageTab(imageTab);
              }).catch(function(error) {
                  // Handle any errors
              });
          });
      })
      .catch((e) => console.log('Errors while downloading => ', e));
  }, []);

  return (<View>
    {imageTab.map(i => (<Image style={{height: 200, width: 200}} source={{uri: i}} />))}
  </View>);
}

export default Photos;

Let me know if it worked :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I display an image from Firebase Storage without repeating image in the loop

From Dev

How do I save an image url from Firebase Storage to Firebase realtime data base, the image from my device

From Dev

How do I loop all Firebase children in React Native?

From Dev

Uploading image from React-Native app to Firebase storage

From Dev

Proper Way to display images from Firebase Storage

From Dev

How can i display all images from a Tumblr blog on my web page using their API?

From Dev

How do I display an image that I just took from my camera in my android app?

From Dev

How do I show a vector icon in my ToolbarAndroid from react-native-vector-icons (react native)

From Dev

How do I show a vector icon in my ToolbarAndroid from react-native-vector-icons (react native)

From Dev

How do I replace a file in an ISO file without needing root from the command line

From Dev

How do i display images from database using image URL using HTML?

From Dev

How do I deserialize a JSON array without needing a wrapper type?

From Dev

how do I include native module (not installed from npm) in my react-native application

From Dev

How do I install a React Native application on my device without the development server and debugging?

From Dev

How do i improve my code to load images from remote server more effiecintly without UI lag?

From Dev

How do I display an image from an attachment?

From Dev

Display images of Firebase Storage with a Firestore query to get image url in Flutter

From Dev

How can I make array of image from Firebase storage?

From Dev

How do I get network images with authentication in React Native?

From Dev

How do I alternate two Images in a react native component

From Dev

How can I get image path from Firebase, get image from firebase storage, and show it?

From Dev

Unable to display all images from firebase database and I want to show all images from one id into grid view

From Dev

How to display images from AWS S3 without downloading in the local storage

From Dev

How do I display an animated gif in React Native?

From Dev

How do I access and display images from an ionic app?

From Dev

How do I make the input read and display my image?

From Dev

How do I display an image via CSS in my local environment?

From Dev

How do I automatically display the first google image on my page?

From Dev

Display images from firebase storage in html img tags

Related Related

  1. 1

    How can I display an image from Firebase Storage without repeating image in the loop

  2. 2

    How do I save an image url from Firebase Storage to Firebase realtime data base, the image from my device

  3. 3

    How do I loop all Firebase children in React Native?

  4. 4

    Uploading image from React-Native app to Firebase storage

  5. 5

    Proper Way to display images from Firebase Storage

  6. 6

    How can i display all images from a Tumblr blog on my web page using their API?

  7. 7

    How do I display an image that I just took from my camera in my android app?

  8. 8

    How do I show a vector icon in my ToolbarAndroid from react-native-vector-icons (react native)

  9. 9

    How do I show a vector icon in my ToolbarAndroid from react-native-vector-icons (react native)

  10. 10

    How do I replace a file in an ISO file without needing root from the command line

  11. 11

    How do i display images from database using image URL using HTML?

  12. 12

    How do I deserialize a JSON array without needing a wrapper type?

  13. 13

    how do I include native module (not installed from npm) in my react-native application

  14. 14

    How do I install a React Native application on my device without the development server and debugging?

  15. 15

    How do i improve my code to load images from remote server more effiecintly without UI lag?

  16. 16

    How do I display an image from an attachment?

  17. 17

    Display images of Firebase Storage with a Firestore query to get image url in Flutter

  18. 18

    How can I make array of image from Firebase storage?

  19. 19

    How do I get network images with authentication in React Native?

  20. 20

    How do I alternate two Images in a react native component

  21. 21

    How can I get image path from Firebase, get image from firebase storage, and show it?

  22. 22

    Unable to display all images from firebase database and I want to show all images from one id into grid view

  23. 23

    How to display images from AWS S3 without downloading in the local storage

  24. 24

    How do I display an animated gif in React Native?

  25. 25

    How do I access and display images from an ionic app?

  26. 26

    How do I make the input read and display my image?

  27. 27

    How do I display an image via CSS in my local environment?

  28. 28

    How do I automatically display the first google image on my page?

  29. 29

    Display images from firebase storage in html img tags

HotTag

Archive