質問編集履歴

4

修正

2020/03/11 09:34

投稿

sheckwes
sheckwes

スコア13

test CHANGED
File without changes
test CHANGED
@@ -166,6 +166,8 @@
166
166
 
167
167
  のところのコードがおかしいと思うのですが、原因がわかっていません。
168
168
 
169
+
170
+
169
171
  ---
170
172
 
171
173
  ###補足

3

詳細な情報の追加

2020/03/11 09:33

投稿

sheckwes
sheckwes

スコア13

test CHANGED
File without changes
test CHANGED
@@ -156,11 +156,15 @@
156
156
 
157
157
  ページを引っ張って更新しようとすると
158
158
 
159
- ReferenceError:Can't find variable:fetchData
159
+ TypeError:undefined is not an object(evaluating 'this.fetchData().then')
160
160
 
161
161
  と出ます。
162
162
 
163
163
 
164
+
165
+ fetchData() {
166
+
167
+ のところのコードがおかしいと思うのですが、原因がわかっていません。
164
168
 
165
169
  ---
166
170
 

2

修正

2020/03/11 09:31

投稿

sheckwes
sheckwes

スコア13

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,9 @@
30
30
 
31
31
  fetchData() {
32
32
 
33
- const querySnapshot = Fire
33
+ const items = [];
34
+
35
+ Fire
34
36
 
35
37
  .shared
36
38
 
@@ -38,19 +40,17 @@
38
40
 
39
41
  .get()
40
42
 
43
+ .then(function(querySnapshot) {
41
44
 
45
+ querySnapshot.forEach(function(doc) {
42
46
 
43
- const items = [];
47
+ items.push(doc.data());
44
48
 
45
- querySnapshot.forEach(doc => {
49
+ });
46
50
 
47
- items.push(doc.data());
51
+ this.setState({ items: items });
48
52
 
49
- });
53
+ });
50
-
51
-
52
-
53
- this.setState({ items: items, refreshing:false });
54
54
 
55
55
  }
56
56
 
@@ -60,7 +60,7 @@
60
60
 
61
61
  this.setState({refreshing: true});
62
62
 
63
- fetchData().then(() => {
63
+ this.fetchData().then(() => {
64
64
 
65
65
  this.setState({refreshing: false});
66
66
 

1

修正

2020/03/11 09:25

投稿

sheckwes
sheckwes

スコア13

test CHANGED
File without changes
test CHANGED
@@ -106,8 +106,6 @@
106
106
 
107
107
  <Container>
108
108
 
109
-
110
-
111
109
  <Content style={styles.cnt} refreshControl={
112
110
 
113
111
  <RefreshControl