React native React Native Firebase-如何从Firebase存储中检索图像并在图像组件中显示?

React native React Native Firebase-如何从Firebase存储中检索图像并在图像组件中显示?,react-native,react-native-firebase,React Native,React Native Firebase,从firebase.storage().ref('asd')获取图像的ref后,如何在此处检索图像并分配给图像组件 const ref = firebase.storage().ref('path/to/image.jpg'); <Image source={?} /> const ref=firebase.storage().ref('path/to/image.jpg'); 您可以对引用调用getDownloadURL(),以获取图像的URL,然后将其作为URI源传递给图

从firebase.storage().ref('asd')获取图像的ref后,如何在此处检索图像并分配给图像组件

const ref = firebase.storage().ref('path/to/image.jpg');

<Image
  source={?}
/>
const ref=firebase.storage().ref('path/to/image.jpg');

您可以对引用调用
getDownloadURL()
,以获取图像的URL,然后将其作为URI源传递给图像组件,例如:

const ref=firebase.storage().ref('path/to/image.jpg');

const url=await ref.getDownloadURL(); // ... 在渲染中
您可以对引用调用
getDownloadURL()
,以获取图像的URL,然后将其作为URI源传递给图像组件,例如:

const ref=firebase.storage().ref('path/to/image.jpg');

const url=await ref.getDownloadURL(); // ... 在渲染中
这可能会很晚,但对我来说很有效。我已经向存储器发出了一个单独的请求,getDownloadURL()在rnfirebase v6中的putFile()上不可用

const ref = firebase.storage().ref("images/name.jpg");
ref.getDownloadURL()
.then(url => {console.log(url)})
.catch(e=>{console.log(e);})

这可能很晚了,但对我来说很有效。我已经向存储器发出了一个单独的请求,getDownloadURL()在rnfirebase v6中的putFile()上不可用

const ref = firebase.storage().ref("images/name.jpg");
ref.getDownloadURL()
.then(url => {console.log(url)})
.catch(e=>{console.log(e);})

现在,您的查询只存储对路径的引用。您需要
.get()
获取该数据。一旦检索到数据,就可以循环并相应地分配它们的源引用。有关
get
的更多数据,请查看文档:现在您的查询仅存储对路径的引用。您需要
.get()
获取该数据。一旦检索到数据,就可以循环并相应地分配它们的源引用。有关
get
的更多数据,请查看文档:升级到V6后,我在putFile方法的result对象中找不到下载url。你知道吗?const url=await ref.getDownloadUrl();这里的方法调用错误,应该是:const url=await ref.getDownloadURL();(最后三个字母大写)升级到V6后,我在putFile方法的结果对象中找不到下载url。你知道吗?const url=await ref.getDownloadUrl();这里的方法调用错误,应该是:const url=await ref.getDownloadURL();(最后三个字母大写)我们将修复此问题-此API应该在UploadTaskSnapshot上存在我们将修复此问题-此API应该在UploadTaskSnapshot上存在