我坚持这个错误。我是初学者,反应原生和firebase。我只想在react native和firebase之间建立连接。 请有人对这个问题有所了解吗?
index.android.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, {Component} from 'react';
import ReactNative from 'react-native';
import * as firebase from 'firebase';
const StatusBar = require('./components/StatusBar');
const ActionButton = require('./components/ActionButton');
const ListItem = require('./components/ListItem');
const styles = require('./styles.js')
// Initialize Firebase
firebase.intializeApp({
apiKey: "XXXX",
authDomain: "XXXX",
databaseURL: "XXXX",
projectId: "XXXX",
storageBucket: "XXXX",
messagingSenderId: "XXXX"
});

Package.js
{
"name": "Primed_Network",
"version": "0.2.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"apsl-react-native-button": "^3.1.0",
"firebase": "^3.1.0",
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-firebase": "^2.1.2",
"react-native-textinput-effects": "^0.4.0",
"react-native-vector-icons": "^4.3.0"
},
}

答案 0 :(得分:1)
尝试像这样导入firebase
import firebase from 'firebase';