使用React-native和Expo下载Firebase Storage文件

时间:2019-08-28 11:05:04

标签: react-native firebase-storage expo

我正在尝试从Firebase Storage上传文件。如果文件存在,没问题,但是如果文件不存在,则无限期调用该函数。

这是我的代码:

async componentWillMount() {
    firebase
        .storage()
        .ref()
        .child(this.props.firebaseUser.uid)
        .getDownloadURL()
        .then(uri => {
            store.dispatch(UpdateUser({ profileImage: uri }));
        })
        .catch((error) => {
            console.log(error)
        });
    }
}

我还尝试添加一个标志firestoreHasBeenCalled,但是该函数仍被无限期调用。我在做什么错了?

0 个答案:

没有答案