在我的本机项目中,我遇到了一些无法在我的项目中安装firebase的问题。
Error message when I insert firebase code
App.js:
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { Header, Card, CardSection, Button } from './components/common';
import firebase from 'firebase';
import LoginForm from './components/LoginForm';
class App extends Component {
componentWillMount() {
const firebase = require('firebase/app');
firebase.initializeApp({
apiKey: '',
authDomain: '',
databaseURL: '',
projectId: '',
storageBucket: '',
messagingSenderId: ''
});
}
render() {
return(
<View>
<Header headerText="Thi is Header" />
<LoginForm />
</View>
);
}
}
export default App;
答案 0 :(得分:0)
您应该使用
const firebase = require('firebase');
答案 1 :(得分:0)
删除import firebase from 'firebase';
,还使用const firebase = require('firebase');
而不是const firebase = require('firebase/app');