4
4
View ,
5
5
Keyboard ,
6
6
AppState ,
7
- Easing ,
8
7
} from 'react-native' ;
9
8
import PropTypes from 'prop-types' ;
10
9
import _ from 'underscore' ;
@@ -65,10 +64,15 @@ class ReportActionsView extends React.Component {
65
64
66
65
this . sortedReportActions = [ ] ;
67
66
this . timers = [ ] ;
68
- this . unreadActionCount = 0 ;
69
- this . shouldShowNewActionIndicator = true ;
70
67
this . unreadIndicatorOpacity = new Animated . Value ( 1 ) ;
71
68
69
+ // Helper variable that keeps track of the unread action count before it updates to zero
70
+ this . unreadActionCount = 0 ;
71
+
72
+ // Helper variable that prevents the unread indicator to show up for new messages
73
+ // received while the report is still active
74
+ this . shouldShowUnreadActionIndicator = true ;
75
+
72
76
this . state = {
73
77
refetchNeeded : true ,
74
78
} ;
@@ -171,7 +175,7 @@ class ReportActionsView extends React.Component {
171
175
* a flag to not show it again if the report is still open
172
176
*/
173
177
setUpUnreadActionIndicator ( ) {
174
- if ( ! this . props . isActiveReport || ! this . shouldShowNewActionIndicator ) {
178
+ if ( ! this . props . isActiveReport || ! this . shouldShowUnreadActionIndicator ) {
175
179
return ;
176
180
}
177
181
@@ -182,14 +186,12 @@ class ReportActionsView extends React.Component {
182
186
this . timers . push ( setTimeout ( ( ) => {
183
187
Animated . timing ( this . unreadIndicatorOpacity , {
184
188
toValue : 0 ,
185
- duration : 500 ,
186
- easing : Easing . ease ,
187
189
useNativeDriver : false ,
188
190
} ) . start ( ) ;
189
191
} , 3000 ) ) ;
190
192
}
191
193
192
- this . shouldShowNewActionIndicator = false ;
194
+ this . shouldShowUnreadActionIndicator = false ;
193
195
}
194
196
195
197
/**
0 commit comments