-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_version
59 lines (54 loc) · 1.21 KB
/
new_version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
FlatList
} from 'react-native';
import styles from '../styles';
import { getDatabase } from '../config/FirebaseConfig'
export default class Profile extends Component {
constructor(props) {
super(props);
this.state = { firebaseItems: {} };
console.ignoredYellowBox = [
'Setting a timer'
];
}
getItems = () => {
var items;
var query = getDatabase().ref().child('attributes');
query.once("value", function(snapshot) {
snapshot.forEach(function(child) {
console.log(child.val().cousine)
items.push({
comment: child.val().cousine
});
});
}).then(() => {
this.setState({firebaseItems: items});
});
}
componentDidMount = () => {
this.getItems();
}
renderRow = ({item, index}) => {
return (
<Text style={{
fontSize: 18,
color: '#000000',
textAlign: 'center'
}}>
{item.cousine}
</Text>
);
};
render() {
console.log(this.state.firebaseItems)
return (
<FlatList data={this.state.firebaseItems}
renderItem={this.renderRow}/>
);
}
}