Reputation: 742
I am trying to develop a feature in my React Native app that when a user signs up to Firebase for the first time, the program assigns the user a default profile picture and stores it in a Storage folder such as:
firebase.storage().ref().child("userImages/" + firebase.auth().currentUser.uid)
I am struggling because I am not having the user pick a photo and therefore I do not have a way to create a blob
from a picture.uri
. The picture that I would like to upload can be in the same directory as my app.js or it can also be a photo off of google images.
What would be the proper way to accomplish this?
Upvotes: 2
Views: 1778
Reputation: 311
One approach you could take is to have a default profile picture in your firestore that is referenced by all users who haven't picked one. You don't need to necessarily upload one each time thereby saving your user data and time.
Each file you upload to Firebase Storage already generates a URL reference. Use that as the default value when you create the user's profile.
Upvotes: 2