설정한 후에는 yarn ios와 yarn android를 다시 실행해주세요. 그다음 UploadScreen의 onSubmit 함수를 구현해보세요.
screens/UploadScreen.js
import {useNavigation, useRoute} from '@react-navigation/native'; import React, {useCallback, useEffect, useRef, useState} from 'react'; import { (...) Platform, } from 'react-native'; import IconRightButton from '../components/IconRightButton'; import storage from '@react-native-firebase/storage'; import {useUserContext} from '../contexts/UserContext'; import {v4} from 'uuid'; import {createPost} from '../lib/posts'; function () { ( ) const {user} = useUserContext(); const onSubmit = useCallback(async () => { navigation.pop(); const asset = res.assets[0]; const extension = asset.fileName.split('.').pop(); const reference = storage().ref(`/photo/${user.id}/${v4()}.${extension}`); if (Platform.OS === 'android') { await reference.putString(asset.base64, 'base64', { contentType: asset.type, }); } else { await reference.putFile(asset.uri); } const photoURL = await reference.getDownloadURL(); await createPost({description, photoURL, user}); // TODO: 포스트 목록 새로고침 }, [res, user, description, navigation]); ( )