【发布时间】:2019-12-28 04:14:32
【问题描述】:
在 expo react native 中初始化 Firebase 配置时出错。意外的令牌“;”
环境: 世博发展 反应原生 火力基地 Visual Studio 代码编辑器
我想要的: 我是新手,正在学习如何使用 firebase 电子邮件/密码方法在 react 本机应用程序中验证 /login。
我做了什么: 在代码编辑器工具--> app.js--> 我导入了 firebase ,创建了一个 const 来定义 firebase 配置参数。
之后,我尝试初始化 firebase 。
有什么问题:
当我在手机上运行应用程序时,出现以下错误。
SyntaxError: C:\Users\Jituni\bholmentorworld\App.js: Unexpected token, expected ";" (32:23)
30 | }; 31 |
32 | firebase.initializeApp{firebaseConfig}; | ^ 33 | 34 |导出默认类 App 扩展 React.Component{
35 |
[import React from "react";
import { Image, Button, TextInput, ScrollView, Stylesheet, Text, View } from "react-native";
import * as firebase from 'firebase';
const firebaseConfig={
apiKey:"AIzaSyDimdV7iWkVaLKpQVqt82_TiSuRA0NBAOE",
authDomain:"firebaseapp",
databaseURL:"mentordunia",
projectId:"mentordunia",
storageBucket:"",
messagingSenderId:"1055433782606",
appId:"b308d4b9d990db06",
};
firebase.initializeApp{firebaseConfig};
export default class App extends React.Component{
render() {
return <AppContainer/>;
}
};][1]
预期结果: 不应收到初始化 firebase 的错误
实际结果: 初始化 firebase 时出错
【问题讨论】:
标签: firebase react-native authentication expo