Retrieve image uploaded to firebase storage and use that URL in my React native expo code

Viewed 179

I'm a little confused how to upload an image from firebase storage into my app. I already have a place holder URL that works fine with another website's URL that acts as the button wallpaper.

<TouchableOpacity onPress={() => navigation.navigate(HGSQ)}>
          <SwiperC imageUri={{uri:'https://images.unsplash.com/photo-1473496169904-658ba7c44d8a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2100&q=80'}} name='Hot Girl Summer'/>
          </TouchableOpacity>

So now to save storage on my App, I was wondering how to use the URL from the saved picture I uploaded to firebase. Would I have to use this code?

import storage from 'firebase/storage'; 
...
const imageURI = await storage().ref('myFolder/myFileName.jpg').getDownloadURL();
...

I tried doing this, but it kept saying the error "unexpected reserve word 'await'." Also just mentioning I already have set up the config for firebase in my code.

1 Answers
Related