Тёмный

Accessing Images from Firebase Storage in React Native 

The Whiz
Подписаться 666
Просмотров 8 тыс.
50% 1

Hello! Welcome to this video. In this video, you will learn how to access images from Firebase Storage inside React Native. Thanks to everyone for letting me know that you wanted this video!
If you learned from this video, give this video a thumbs up and subscribe to this channel! To stay updated on all our future videos, click the notification bell!
Expo Documentation on Firebase: docs.expo.dev/guides/using-fi...
Code: drive.google.com/drive/folder...
App Development: • App Development
Don't forget to comment down below on what you want to see next (or if you have any questions)!

Опубликовано:

 

11 фев 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 27   
@bilalawad8937
@bilalawad8937 2 года назад
Thank you sooooooooooo much, others were making it harder by using fileReader, this is 10x easier thank you! PS, i use react but i am learning react-native which is why i needed this!
@gtasa0629
@gtasa0629 Год назад
Thank you so much! I have been searching for this a long time.... Thank you Once again!
@810886
@810886 2 года назад
Thanks! This really helps a lot!!!
@talbertherndon1925
@talbertherndon1925 2 года назад
Thank you much needed ❤️
@mucadush3363
@mucadush3363 2 года назад
i love your energy omg
@microsoftus-eu5323
@microsoftus-eu5323 2 года назад
U deserve the world ❤
@mucadush3363
@mucadush3363 2 года назад
bro i love you THANK YOU
@gokulkrishna.s5691
@gokulkrishna.s5691 Год назад
Thank helpfull video😍
@sohailpanchoo848
@sohailpanchoo848 2 года назад
thank you soooooooooooooooooooooooooooooooooooooooooooooooo much you helped me a lot i was really stuck
@joshuaborseth
@joshuaborseth 2 года назад
thanks for your help!! you explain stuff very well!
@mamadouseck3612
@mamadouseck3612 Год назад
Thanks
@alaamer7303
@alaamer7303 11 месяцев назад
thanks
@gtasa0629
@gtasa0629 Год назад
Please teach us everything about firebase react native expo please!😘
@gtasa0629
@gtasa0629 Год назад
Hello Please put a video on how to edit metadata on firebase storage in react native
@kingogamer4358
@kingogamer4358 Год назад
I have tried the same pattern but i donot get the url
@abdul-samadnasir3318
@abdul-samadnasir3318 2 года назад
Please do you how to display data from firestore to a pie chart
@the_whiz
@the_whiz 2 года назад
1. get the data from firestore 2. store data into state 3. create the pie chart with data from the state variable you can reference this person's github for a good example: github.com/Eesha-Jain/PollYourOwn/blob/main/screens/TabTwoScreen.tsx
@brnbk8910
@brnbk8910 Год назад
I need to render in my app the image that is in the firestore, the url is already there, I want to send an image from my gallery, I want it to go to the firestore, and store the url there, and with this url render in my application, HELP ME
@the_whiz
@the_whiz Год назад
maybe try this: www.themobileentity.com/home/how-to-load-image-from-url-in-react-native
@akshatsrivastav9911
@akshatsrivastav9911 2 года назад
hey could you help me out with this , const uploadPost = async () => { setRequestRunning(true); const response = await fetch(uri); const bloob = await getBlobFromUri(uri); const storageRef = ref(storage, `hbdas/${user.user.uid}/${uuid()}}`); const uploadTask = uploadBytes(storageRef, bloob); await getDownloadURL(uploadTask).then((x) => { setUrl(x); console.log(x); }); it just gets stuck and doesn't print the x
@the_whiz
@the_whiz 2 года назад
I believe your in the storageReference creation line, you miswrote the location to the image. Look at my video for an example of how it should be done.
@rushikeshgodse1206
@rushikeshgodse1206 2 года назад
but how could i get multiple images ??? just HOwwwwWWWWW PlzzzzzzzzzzzZZZZ
@the_whiz
@the_whiz 2 года назад
you can iterate through an array to get multiple images or call this function many times
@cineverseproductions
@cineverseproductions 2 года назад
Great and simple video BUT I have a question and a doubt. I am using ImagePicker from Expo like one of your previous videos, and if(!result.cancelled), I am setting an image on a useState hook variable like setImage(result.uri) which is fine, and my uploadImage() is uploading images with the blob and I can see the images being uploaded by a specific uid(probably my current logged in user) in my firebase storage. BUT now, when I try to retrieve it back like yours with useEffect, it's not showing me any image in my Image source. Code is pretty much the same BUT do you think, your *setUrl* hook variable is mine *setImage* in this case. Because in the source is {{ uri: image }} ? I have attached my code below. const [image, setImage] = useState("upload.wikipedia/commons/7/7c/Profile_avatar_placeholder_large.png"); const pickImage = async () => { // No permissions request is necessary for launching the image library let result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.All, allowsEditing: true, aspect: [4, 3], quality: 1, }); if (!result.cancelled) { setImage(result.uri || url); uploadImage(); } }; const uploadImage = async () => { const blob = await new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.onload = function() { resolve(xhr.response); } xhr.onerror = function(e) { reject(new TypeError("Network request failed")); }; xhr.responseType = "blob"; xhr.open("GET", image, true); xhr.send(null); }); const ref = firebase .storage() .ref() .child(`${auth.currentUser.uid}/profile_pic.jpg`); const snapshot = await ref.put(blob); const remoteUri = await snapshot.ref.getDownloadURL() // when we're done sending it, close and release the blob blob.close(); // return the result, eg. remote URI to the image return remoteUri; } useEffect(() => { const func = async () => { const storage = getStorage(); const reference = ref(storage, `${auth.currentUser.uid}/profile_pic.jpg`); await getDownloadURL(reference).then(url => { setImage(url); }) if(url == undefined) { func(); } } },[]); {image && }
@the_whiz
@the_whiz 2 года назад
in your useEffect, after the function do you see the []? you need to put the image into that so it looks like useEffect(()=>{...}, [image]). This means that it will update the screen with the image.
@cineverseproductions
@cineverseproductions 2 года назад
@@the_whiz Hi there. Thanks for getting back to me on this so quickly. I tried putting the image hook variable in [ ] useEffect in the end and try loading the app again, but the image is not loading and appearing in the url. The code is exactly the same to my above comment ☝️ but it's not working. I'm not sure what's wrong. Again, I will attach the useEffect code snippet below. useEffect(() => { const func = async () => { const storage = getStorage(); const reference = ref(storage, `${auth.currentUser.uid}/profile_pic.jpg`); await getDownloadURL(reference).then(url => { console.log(url); setImage(url); }) if(url == undefined || null) { func(); } } },[image]);
@the_whiz
@the_whiz 2 года назад
@@cineverseproductions I still think it's an issue with the dynamic updating. nkaushik.com/react-native/dynamic-image-source-in-react-native/ maybe try this?
Далее
It works! #beatbox #tiktok
00:15
Просмотров 2,5 млн
Clowns abuse children#Short #Officer Rabbit #angel
00:51
Fetching API Requests in React Native
4:59
Asyncstorage React Native | Async Storage Tutorial
14:19
Image Upload in React Native | Expo App
9:24
Просмотров 23 тыс.