-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify new line indicator and message badge #10582
Changes from all commits
0107ad3
c78fd56
ebd4ac2
cc2a820
7451e17
64eed1c
8b72671
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,9 @@ import CONST from '../../../CONST'; | |
import * as StyleUtils from '../../../styles/StyleUtils'; | ||
|
||
const propTypes = { | ||
/** Position of the "New" line marker */ | ||
newMarkerSequenceNumber: PropTypes.number.isRequired, | ||
|
||
/** Personal details of all the users */ | ||
personalDetails: PropTypes.objectOf(participantPropTypes), | ||
|
||
|
@@ -30,9 +33,6 @@ const propTypes = { | |
/** The largest sequenceNumber on this report */ | ||
maxSequenceNumber: PropTypes.number, | ||
|
||
/** The current position of the new marker */ | ||
newMarkerSequenceNumber: PropTypes.number, | ||
|
||
/** Whether there is an outstanding amount in IOU */ | ||
hasOutstandingIOU: PropTypes.bool, | ||
}).isRequired, | ||
|
@@ -134,8 +134,10 @@ class ReportActionsList extends React.Component { | |
item, | ||
index, | ||
}) { | ||
const shouldDisplayNewIndicator = this.props.report.newMarkerSequenceNumber > 0 | ||
&& item.action.sequenceNumber === this.props.report.newMarkerSequenceNumber; | ||
// When the new indicator should not be displayed we explicitly set it to 0. The marker should never be shown above the | ||
// created action (which will have sequenceNumber of 0) so we use 0 to indicate "hidden". | ||
const shouldDisplayNewIndicator = this.props.newMarkerSequenceNumber > 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the first condition needed here? can both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we explicitly set this to zero, could we set to null to indicate the lack of a value here instead? NAB but since zero could be a valid sequence number (just based on the data type), null could be a little cleaner There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if I understand the question. But the newMarkerSequenceNumber can be equal to zero and the created action has a sequenceNumber of 0. So we do this to avoid showing the marker for the "created" action. We don't want to show the marker when the last read sequenceNumber is 0. As for using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if this comment helps. Or if you feel strongly that we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment makes sense to me, so I agree it's 👌 to leave it using |
||
&& item.action.sequenceNumber === this.props.newMarkerSequenceNumber; | ||
return ( | ||
<ReportActionItem | ||
reportID={this.props.report.reportID} | ||
|
@@ -171,7 +173,7 @@ class ReportActionsList extends React.Component { | |
render() { | ||
// Native mobile does not render updates flatlist the changes even though component did update called. | ||
// To notify there something changes we can use extraData prop to flatlist | ||
const extraData = (!this.props.isDrawerOpen && this.props.isSmallScreenWidth) ? this.props.report.newMarkerSequenceNumber : undefined; | ||
const extraData = (!this.props.isDrawerOpen && this.props.isSmallScreenWidth) ? this.props.newMarkerSequenceNumber : undefined; | ||
const shouldShowReportRecipientLocalTime = ReportUtils.canShowReportRecipientLocalTime(this.props.personalDetails, this.props.report); | ||
return ( | ||
<Animated.View style={StyleUtils.getReportListAnimationStyle(this.state.fadeInAnimation)}> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean the new messages indicator can't be closed with an
X
? Why the change? Just curiousThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Largely just a matter of simplification and nobody fought to keep it. In the new design, the visibility of the component is enabled based on these conditions alone:
Doc here -> https://docs.google.com/document/d/1gvPDhGTxdcu-0lQxvruQnQJfJBrAmSjHieKciucV8eo/edit#bookmark=id.v1smzjvcr8ra
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's something we'll miss? Should be relatively easy to add it back in if so. I kinda found it just made the code harder to understand and not really all that useful of a feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I like this change actually, this was just my first time looking at this code, and this is a change I "picked up" that I wasn't expecting, and I wanted to make sure I understood it correctly, since I'm still kind of a noob when it comes to reviews in App