Vin*_*les 1 react-native react-native-firebase
从 firebase.storage().ref('asd') 获取图像的 ref 后,如何在此处检索图像并分配给 Image 组件?
const ref = firebase.storage().ref('path/to/image.jpg');
<Image
source={?}
/>
Run Code Online (Sandbox Code Playgroud)
您可以调用getDownloadURL()引用以获取图像的 URL,然后可以将其作为 URI 源传递给 Image 组件,例如:
const ref = firebase.storage().ref('path/to/image.jpg');
const url = await ref.getDownloadURL();
// ... in your render
<Image
source={{ uri: url }}
/>Run Code Online (Sandbox Code Playgroud)
文档:
v5:https : //rnfirebase.io/docs/v5.xx/storage/reference/Reference#getDownloadURL
v6:https : //invertase.io/oss/react-native-firebase/v6/storage/reference/reference#getDownloadURL
| 归档时间: |
|
| 查看次数: |
11769 次 |
| 最近记录: |