@@ -31,13 +31,13 @@ import EmojiPicker from '../../../components/EmojiPicker/EmojiPicker';
31
31
import * as ReportActionsUtils from '../../../libs/ReportActionsUtils' ;
32
32
33
33
const propTypes = {
34
- /** The ID of the report actions will be created for */
35
- reportID : PropTypes . number . isRequired ,
36
-
37
34
/* Onyx Props */
38
35
39
36
/** The report currently being looked at */
40
37
report : PropTypes . shape ( {
38
+ /** The ID of the report actions will be created for */
39
+ reportID : PropTypes . number ,
40
+
41
41
/** Number of actions unread */
42
42
unreadActionCount : PropTypes . number ,
43
43
@@ -52,7 +52,7 @@ const propTypes = {
52
52
53
53
/** Are we loading more report actions? */
54
54
isLoadingMoreReportActions : PropTypes . bool ,
55
- } ) ,
55
+ } ) . isRequired ,
56
56
57
57
/** Array of report actions for this report */
58
58
reportActions : PropTypes . objectOf ( PropTypes . shape ( reportActionPropTypes ) ) ,
@@ -75,12 +75,6 @@ const propTypes = {
75
75
} ;
76
76
77
77
const defaultProps = {
78
- report : {
79
- unreadActionCount : 0 ,
80
- maxSequenceNumber : 0 ,
81
- hasOutstandingIOU : false ,
82
- isLoadingMoreReportActions : false ,
83
- } ,
84
78
reportActions : { } ,
85
79
session : { } ,
86
80
} ;
@@ -118,23 +112,23 @@ class ReportActionsView extends React.Component {
118
112
return ;
119
113
}
120
114
121
- Report . openReport ( this . props . reportID ) ;
115
+ Report . openReport ( this . props . report . reportID ) ;
122
116
} ) ;
123
117
124
118
// If the reportID is not found then we have either not loaded this chat or the user is unable to access it.
125
119
// We will attempt to fetch it and redirect if still not accessible.
126
120
if ( ! this . props . report . reportID ) {
127
- Report . fetchChatReportsByIDs ( [ this . props . reportID ] , true ) ;
121
+ Report . fetchChatReportsByIDs ( [ this . props . report . reportID ] , true ) ;
128
122
}
129
- Report . subscribeToReportTypingEvents ( this . props . reportID ) ;
123
+ Report . subscribeToReportTypingEvents ( this . props . report . reportID ) ;
130
124
this . keyboardEvent = Keyboard . addListener ( 'keyboardDidShow' , ( ) => {
131
125
if ( ! ReportActionComposeFocusManager . isFocused ( ) ) {
132
126
return ;
133
127
}
134
128
ReportScrollManager . scrollToBottom ( ) ;
135
129
} ) ;
136
130
137
- Report . openReport ( this . props . reportID ) ;
131
+ Report . openReport ( this . props . report . reportID ) ;
138
132
}
139
133
140
134
shouldComponentUpdate ( nextProps , nextState ) {
@@ -187,7 +181,7 @@ class ReportActionsView extends React.Component {
187
181
componentDidUpdate ( prevProps ) {
188
182
if ( lodashGet ( prevProps . network , 'isOffline' ) && ! lodashGet ( this . props . network , 'isOffline' ) ) {
189
183
if ( this . getIsReportFullyVisible ( ) ) {
190
- Report . openReport ( this . props . reportID ) ;
184
+ Report . openReport ( this . props . report . reportID ) ;
191
185
} else {
192
186
this . fetchData ( ) ;
193
187
}
@@ -223,14 +217,14 @@ class ReportActionsView extends React.Component {
223
217
// When the last action changes, record the max action
224
218
// This will make the NEW marker line go away if you receive comments in the same chat you're looking at
225
219
if ( isReportFullyVisible ) {
226
- Report . readNewestAction ( this . props . reportID ) ;
220
+ Report . readNewestAction ( this . props . report . reportID ) ;
227
221
}
228
222
}
229
223
230
224
// Update the new marker position and last read action when we are closing the sidebar or moving from a small to large screen size
231
225
if ( isReportFullyVisible && reportBecomeVisible ) {
232
226
this . updateNewMarkerPosition ( this . props . report . unreadActionCount ) ;
233
- Report . openReport ( this . props . reportID ) ;
227
+ Report . openReport ( this . props . report . reportID ) ;
234
228
}
235
229
}
236
230
@@ -243,7 +237,7 @@ class ReportActionsView extends React.Component {
243
237
this . appStateChangeListener . remove ( ) ;
244
238
}
245
239
246
- Report . unsubscribeFromReportChannel ( this . props . reportID ) ;
240
+ Report . unsubscribeFromReportChannel ( this . props . report . reportID ) ;
247
241
}
248
242
249
243
/**
@@ -255,7 +249,7 @@ class ReportActionsView extends React.Component {
255
249
}
256
250
257
251
fetchData ( ) {
258
- Report . fetchInitialActions ( this . props . reportID ) ;
252
+ Report . fetchInitialActions ( this . props . report . reportID ) ;
259
253
}
260
254
261
255
/**
@@ -280,13 +274,13 @@ class ReportActionsView extends React.Component {
280
274
// Retrieve the next REPORT.ACTIONS.LIMIT sized page of comments, unless we're near the beginning, in which
281
275
// case just get everything starting from 0.
282
276
const oldestActionSequenceNumber = Math . max ( minSequenceNumber - CONST . REPORT . ACTIONS . LIMIT , 0 ) ;
283
- Report . readOldestAction ( this . props . reportID , oldestActionSequenceNumber ) ;
277
+ Report . readOldestAction ( this . props . report . reportID , oldestActionSequenceNumber ) ;
284
278
}
285
279
286
280
scrollToBottomAndMarkReportAsRead ( ) {
287
281
ReportScrollManager . scrollToBottom ( ) ;
288
- Report . readNewestAction ( this . props . reportID ) ;
289
- Report . setNewMarkerPosition ( this . props . reportID , 0 ) ;
282
+ Report . readNewestAction ( this . props . report . reportID ) ;
283
+ Report . setNewMarkerPosition ( this . props . report . reportID , 0 ) ;
290
284
}
291
285
292
286
/**
@@ -298,7 +292,7 @@ class ReportActionsView extends React.Component {
298
292
// We determine the last read action by deducting the number of unread actions from the total number.
299
293
// Then, we add 1 because we want the New marker displayed over the oldest unread sequence.
300
294
const oldestUnreadSequenceNumber = unreadActionCount === 0 ? 0 : this . props . report . lastReadSequenceNumber + 1 ;
301
- Report . setNewMarkerPosition ( this . props . reportID , oldestUnreadSequenceNumber ) ;
295
+ Report . setNewMarkerPosition ( this . props . report . reportID , oldestUnreadSequenceNumber ) ;
302
296
}
303
297
304
298
/**
0 commit comments