我想在firebase中使用react-native
添加一些值它在我的android模拟器中工作正常,但firebase没有获取数据
这是我的依赖
" firebase":" ^ 3.6.9", "反应":" 15.4.2", " react-native":" 0.41.2",
这是我的代码
import React, { Component } from 'react';
import Firebase from 'firebase';
class FoodApp extends Component {
constructor(props){
super(props);
var config = {
apiKey: "AIzaSyC-7eB-K4LxCvnBVVmRrKZWaN8zgMAOHgc",
authDomain: "chatapp-1d56d.firebaseapp.com",
databaseURL: "https://chatapp-1d56d.firebaseio.com",
storageBucket: "chatapp-1d56d.appspot.com"
};
Firebase.initializeApp(config);
var database = Firebase.database();
database.ref().set({
title:'test',
author:'tomlishan'
});
}
render() {
return (
<Text>
hi
</Text>
);
}
}
这是我的数据库规则
{
"rules": {
".read": "true",
".write": "true"
}
}
我错过了什么吗?