Moka-react / Trouble-Shooting

해당 레포에 질문을 이슈로 남겨주세요 ❤️
9 stars 1 forks source link

Firebase ReferenceError: Can't find variable: firebase 오류 #10

Closed flockcomputercompany closed 4 years ago

flockcomputercompany commented 4 years ago

app.js

import React from "react";

import { createAppContainer, createSwitchNavigator } from "react-navigation"; import { createStackNavigator } from "react-navigation-stack"; import { createBottomTabNavigator } from "react-navigation-tabs"; import { Ionicons } from "@expo/vector-icons"; import LoadingScreen from "./screens/LoadingScreen"; import LoginScreen from "./screens/LoginScreen"; import RegisterScreen from "./screens/RegisterScreen";

import HomeScreen from "./screens/HomeScreen"; import MessageScreen from "./screens/MessageScreen"; import PostScreen from "./screens/PostScreen"; import NotificationScreen from "./screens/NotificationScreen"; import ProfileScreen from "./screens/ProfileScreen";

const AppContainer = createStackNavigator( { default: createBottomTabNavigator( { Home: { screen: HomeScreen, navigationOptions: { tabBarIcon: ({ tintColor }) => } }, Message: { screen: MessageScreen, navigationOptions: { tabBarIcon: ({ tintColor }) => } }, Post: { screen: PostScreen, navigationOptions: { tabBarIcon: ({ tintColor }) => ( <Ionicons name="ios-add-circle" size={48} color="#E9446A" style={{ shadowColor: "#E9446A", shadowOffset: { width: 0, height: 10 }, shadowRadius: 10, shadowOpacity: 0.3 }} /> ) } }, Notification: { screen: NotificationScreen, navigationOptions: { tabBarIcon: ({ tintColor }) => } }, Profile: { screen: ProfileScreen, navigationOptions: { tabBarIcon: ({ tintColor }) => } } }, { defaultNavigationOptions: { tabBarOnPress: ({ navigation, defaultHandler }) => { if (navigation.state.key === "Post") { navigation.navigate("postModal"); } else { defaultHandler(); } } }, tabBarOptions: { activeTintColor: "#161F3D", inactiveTintColor: "#B8BBC4", showLabel: false } } ), postModal: { screen: PostScreen } }, { mode: "modal", headerMode: "none" // initialRouteName: "postModal" } );

const AuthStack = createStackNavigator({ Login: LoginScreen, Register: RegisterScreen });

export default createAppContainer( createSwitchNavigator( { Loading: LoadingScreen, App: AppContainer, Auth: AuthStack }, { initialRouteName: "Loading" } ) );

config.js

var firebaseConfig = { apiKey: "AIzaSyCBhu8tw6xaOrl3QlfMEmJtGwOl1SKp3d4", authDomain: "newtodo-af2fa.firebaseapp.com", databaseURL: "https://newtodo-af2fa.firebaseio.com", projectId: "newtodo-af2fa", storageBucket: "newtodo-af2fa.appspot.com", messagingSenderId: "897203559853", appId: "1:897203559853:web:ea8a317723d03f24e79524" };

firebase.initializeApp(firebaseConfig);

에러

KakaoTalk_20200525_084111436

부가설명

초보의 머리로 이해하면 firebase API키를 잘못한것 같은데 어떻게 해결해야하는거죠 ㅜㅜ

깃헙

https://github.com/jsongbana/SocialApp/tree/master App.js랑 config.js 업로드 해놨습니다 ㅜㅜ

zi-gae commented 4 years ago

cant find variable: firebase config.js 마지막 줄 firebase 선언 안됐습니다

키는 가리고 올리시는걸 추천드릴게요!

flockcomputercompany commented 4 years ago

cant find variable: firebase

config.js 마지막 줄 firebase 선언 안됐습니다

키는 가리고 올리시는걸 추천드릴게요!

선언을 어떻게 하는건가요???

zi-gae commented 4 years ago

https://www.npmjs.com/package/firebase 참고하세요

안된다면 어쩔 수 없지만 깃허브를 올리실땐 전체 폴더를 올려주세요.

flockcomputercompany commented 4 years ago

https://www.npmjs.com/package/firebase 참고하세요

안된다면 어쩔 수 없지만 깃허브를 올리실땐 전체 폴더를 올려주세요.

주신 링크를 보고 시도를 해보려했는데 글이 잘이해가 안됩니다..ㅠ

zi-gae commented 4 years ago

어떤 부분이 이해가 안가는지 명확하게 질문해주세용 docs 보는것도 노력이 필요합니다

아예 몰라서 질문을 못하겠다: js 기초 부족

사실 첫번째 코멘트에 답이 있습니다. 선언 방법을 모르신다면 js 가 부족한거니 js 공부를 해보세용!