Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何将本地映像共享给Firebase,然后检索我在React Native中登录的任何设备?_Reactjs_React Native_Firebase Realtime Database_Redux_React Native Firebase - Fatal编程技术网

Reactjs 如何将本地映像共享给Firebase,然后检索我在React Native中登录的任何设备?

Reactjs 如何将本地映像共享给Firebase,然后检索我在React Native中登录的任何设备?,reactjs,react-native,firebase-realtime-database,redux,react-native-firebase,Reactjs,React Native,Firebase Realtime Database,Redux,React Native Firebase,我正在尝试将图像发布到Firebase实时数据库。直到现在,我已经成功地做到了这一点,图像可以显示,但只有当我仍然连接应用程序,还没有重新加载 我知道原因是因为我在数据库上发布的uri类型如下: content://com.google.android.apps.photos.contentprovider/0/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F58/ORIGINAL/NONE/image%2Fjpeg/484166561

我正在尝试将图像发布到Firebase实时数据库。直到现在,我已经成功地做到了这一点,图像可以显示,但只有当我仍然连接应用程序,还没有重新加载

我知道原因是因为我在数据库上发布的
uri
类型如下:

content://com.google.android.apps.photos.contentprovider/0/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F58/ORIGINAL/NONE/image%2Fjpeg/484166561
以下是Redux操作中用于添加帖子的代码:

export const addPost = (postImage, date, description, checkin_location) => {
    return async (dispatch, getState) => {
        const token = getState().auth.user.token;
        const userId = getState().auth.user.uid;
            const response = await fetch(
                `https://..../users/${userId}/posts.json?auth=${token}`, {
                    method: 'POST',
                    headers:{
                        'Content-Type': 'application/json'
                    },
                    credentials: 'same-origin',
                    body: JSON.stringify({
                        postImage,
                        date,
                        description,
                        checkin_location,
                    })
                });

            const resData = await response.json();
            console.log(resData);
            if(!response.ok){
                console.log("reponse isn't ok in post action ", response)
            };

            dispatch({
                type: ADD_POST,
                postData:{
                    id: resData.name,
                    ownerId: userId,
                    postImage,
                    date,
                    description,
                    checkin_location
                }
            })
    }
}
为了实现这一目标,我应该做些什么

或者更准确地说,我如何将
uri
链接转换为
url
或至少是
Image
组件可以显示的类型,即使在我重新加载或由其他设备登录时也是如此

我正在使用实时数据库,听说过Firestore和云功能,但还没有使用过

请帮忙