0
난 파이어베이스 3.4.1을 사용하고 반응 네이티브 0.34.1.반응이 너무 느린 네이티브 화염대
검색된 데이터를 수신하는 것이 firebase에서 매우 느리다는 것에 놀랐습니다.
내 반응 테스트 코드입니다.
class test1 extends Component {
constructor(){
super();
let config = {
apiKey: "xxxxxxxxxxxxxx",
authDomain: "yyyyyyyy.firebaseapp.com",
databaseURL: "https://zzzzzz.firebaseio.com",
};
Firebase.initializeApp(config);
this.rootRef = Firebase.database().ref();
this.postRef = this.rootRef.child('posts');
this.state = {
like : 'like : ',
comment : 'comment : ',
};
componentWillMount(){
console.debug('componentWillMount');
let num = 0;
let time = new Date().getTime();
this.postRef.orderByKey().limitToLast(10).once('value')
.then((postsnap) => {
console.debug(new Date().getTime() - time);
postsnap.forEach((postItem) => {
console.debug(num++);
console.debug(new Date().getTime() - time);
this.setState({
like : this.state.like + postItem.child('like').numChildren() + ', ',
comment : this.state.comment + postItem.child('comment').numChildren() + ', ',
});
});
});
}
render() {
return (
<View style={styles.container}>
<Text>
{this.state.like}
</Text>
<Text>
{this.state.comment}
</Text>
</View>
);
}
}
내 중포 기지 데이터베이스의 구조는 'rootref은 그냥 6'게시물 '이 매우 간단합니다.
componentWillMount
8760
0
8761
1
8766
2
8767
3
8768
4
8769
5
8772
너희들 중포 기지에서 빠른 데이터 검색에 대한 어떤 생각을 가지고 있습니까?
데이터 검색 성능은 일반적으로 요청한 데이터의 양을 조합 한 다음 사용 가능한 대역폭으로 나누는 것입니다. React Native 설정에 문제가있을 수 있지만 그 일을 위해 할 수있는 방법은 없습니다. 문제를 재현하는 정규 jsbin/jsfiddle을 설정할 수 있습니까? –
연결 문제 인 것 같아요. 접속 후 시간이 없습니다. –