@@ -19,6 +19,7 @@ import { fetchGistComments, deleteComment, addComment } from '../gists.actiontyp
19
19
import ListEmptyComponent from './components/EmptyListComponent' ;
20
20
import { colors } from '../../config' ;
21
21
import GistOptions from './components/gistoptions.screen' ;
22
+ import { clearCache } from '../../cache/cache.actionType' ;
22
23
23
24
const CardContainer = styled ( CardView ) `
24
25
padding: 3%;
@@ -78,7 +79,6 @@ const ActivityIndicatorContainer = styled.View`
78
79
justify-content: center;
79
80
align-items: center;
80
81
` ;
81
- // padding: 20;
82
82
const EndOfViewStyle = styled . View `
83
83
flex: 1;
84
84
justify-content: center;
@@ -99,7 +99,7 @@ class GistCommentsScreen extends React.Component {
99
99
} ;
100
100
}
101
101
componentDidMount ( ) {
102
- this . fetchComments ( ) ;
102
+ this . fetchComments ( true ) ;
103
103
}
104
104
105
105
onPressItem = ( ) => {
@@ -122,8 +122,8 @@ class GistCommentsScreen extends React.Component {
122
122
} ) ;
123
123
}
124
124
125
- fetchComments = ( ) => {
126
- this . props . fetchComments ( this . props . navigation . getParam ( 'gistData' ) . id ) ;
125
+ fetchComments = ( clearCache = false ) => {
126
+ this . props . fetchComments ( { id : this . props . navigation . getParam ( 'gistData' ) . id , clearCache } ) ;
127
127
}
128
128
129
129
deleteComment = ( ) => {
@@ -135,11 +135,10 @@ class GistCommentsScreen extends React.Component {
135
135
}
136
136
137
137
handleOnEndReached = ( ) => {
138
- this . props . fetchComments ( this . props . navigation . getParam ( 'gistData' ) . id ) ;
138
+ this . fetchComments ( ) ;
139
139
}
140
140
141
141
renderItem = ( { item } ) => {
142
- console . log ( 'item type=============' , item . type ) ;
143
142
switch ( item . type ) {
144
143
case 'preloader' :
145
144
return (
@@ -183,20 +182,12 @@ class GistCommentsScreen extends React.Component {
183
182
}
184
183
185
184
render ( ) {
186
- const { inProgress , hasMoreComments, comments } = this . props ;
185
+ const { hasMoreComments, comments } = this . props ;
187
186
188
- console . log ( 'hasMoreComments' , hasMoreComments ) ;
189
187
const toAppendData = hasMoreComments ? getGistComments ( 'preloader' ) : getGistComments ( 'noData' ) ;
190
188
191
189
const uniqComments = uniqBy ( concat ( comments , toAppendData ) , ( { id } ) => ( id ) ) ;
192
190
193
- // if (inProgress) {
194
- // return (
195
- // <ActivityIndicatorContainer>
196
- // <ActivityIndicator size="large" color="#33B5E5" />
197
- // </ActivityIndicatorContainer>
198
- // );
199
- // }
200
191
201
192
return (
202
193
< React . Fragment >
@@ -236,7 +227,7 @@ class GistCommentsScreen extends React.Component {
236
227
}
237
228
}
238
229
const mapDispatchToProps = dispatch => ( {
239
- fetchComments : id => dispatch ( fetchGistComments . action ( id ) ) ,
230
+ fetchComments : data => dispatch ( fetchGistComments . action ( data ) ) ,
240
231
deleteThisComment : data => dispatch ( deleteComment . action ( data ) ) ,
241
232
addThisComment : data => dispatch ( addComment . action ( data ) ) ,
242
233
} ) ;
@@ -248,8 +239,6 @@ const mapStateToProps = ({ gistComments, loggedInUser }) => ({
248
239
} ) ;
249
240
250
241
GistCommentsScreen . propTypes = {
251
- // comments: PropTypes.arrayOf(React.PropTypes.object).isRequired,
252
- inProgress : PropTypes . bool . isRequired ,
253
242
fetchComments : PropTypes . func . isRequired ,
254
243
addThisComment : PropTypes . func . isRequired ,
255
244
deleteThisComment : PropTypes . func . isRequired ,
0 commit comments