diff --git a/src/languages/en.js b/src/languages/en.js index fa0422a29fcb..3b790e556711 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -136,7 +136,7 @@ export default { beFirstPersonToComment: 'Be the first person to comment', }, reportActionsViewMarkerBadge: { - newMsg: ({count}) => `${count} new messages`, + newMsg: ({count}) => `${count} new message${count > 1 ? 's' : ''}`, }, reportTypingIndicator: { isTyping: 'is typing...', diff --git a/src/languages/es.js b/src/languages/es.js index 709a664cb959..92e4f026be14 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -136,7 +136,7 @@ export default { beFirstPersonToComment: 'Sé el primero en comentar', }, reportActionsViewMarkerBadge: { - newMsg: ({count}) => `${count} nuevos mensajes`, + newMsg: ({count}) => `${count} nuevo${count > 1 ? 's' : ''} mensaje${count > 1 ? 's' : ''}`, }, reportTypingIndicator: { isTyping: 'está escribiendo...', diff --git a/src/pages/home/report/MarkerBadge.js b/src/pages/home/report/MarkerBadge.js index a43d6eec55f1..f060f305dd05 100644 --- a/src/pages/home/report/MarkerBadge.js +++ b/src/pages/home/report/MarkerBadge.js @@ -11,16 +11,16 @@ import withLocalize, {withLocalizePropTypes} from '../../../components/withLocal const MARKER_NOT_ACTIVE_TRANSLATE_Y = -30; const MARKER_ACTIVE_TRANSLATE_Y = 10; const propTypes = { - /** Count of messages to show in the badge */ + /** Count of new messages to show in the badge */ count: PropTypes.number, - /** whether the marker is active */ + /** Whether the marker is active */ active: PropTypes.bool, - /** Callback to be called when user click the badge */ + /** Callback to be called when user closes the badge */ onClose: PropTypes.func, - /** Callback to be called when user close the marker */ + /** Callback to be called when user clicks the marker */ onClick: PropTypes.func, ...withLocalizePropTypes, @@ -31,7 +31,7 @@ const defaultProps = { onClose: () => {}, onClick: () => {}, }; -class Markerbadge extends PureComponent { +class MarkerBadge extends PureComponent { constructor(props) { super(props); this.translateY = new Animated.Value(MARKER_NOT_ACTIVE_TRANSLATE_Y); @@ -118,8 +118,8 @@ class Markerbadge extends PureComponent { } } -Markerbadge.propTypes = propTypes; -Markerbadge.defaultProps = defaultProps; -Markerbadge.displayName = 'Markerbadge'; +MarkerBadge.propTypes = propTypes; +MarkerBadge.defaultProps = defaultProps; +MarkerBadge.displayName = 'MarkerBadge'; -export default withLocalize(Markerbadge); +export default withLocalize(MarkerBadge); diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index 898b3f333931..5f1dad210245 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -110,6 +110,7 @@ class ReportActionsView extends React.Component { this.trackScroll = this.trackScroll.bind(this); this.showMarker = this.showMarker.bind(this); this.hideMarker = this.hideMarker.bind(this); + this.toggleMarker = this.toggleMarker.bind(this); } componentDidMount() { @@ -200,8 +201,8 @@ class ReportActionsView extends React.Component { updateLastReadActionID(this.props.reportID); } - // show new Marker badge when there is a new Message - this.showMarker(); + // show new MarkerBadge when there is a new Message + this.toggleMarker(); } // We want to mark the unread comments when user resize the screen to desktop @@ -360,24 +361,27 @@ class ReportActionsView extends React.Component { } /** - * Show the new Markerbadge when user is looking at the History of messages - * - * @memberof ReportActionsView + * Show/hide the new MarkerBadge when user is scrolling back/forth in the history of messages. */ - showMarker() { + toggleMarker() { if (this.currentScrollOffset < -200 && !this.state.isMarkerActive) { - this.setState({isMarkerActive: true}); + this.showMarker(); } if (this.currentScrollOffset > -200 && this.state.isMarkerActive) { - this.setState({isMarkerActive: false}); + this.hideMarker(); } } + /** + * Show the new MarkerBadge + */ + showMarker() { + this.setState({isMarkerActive: true}); + } + /** * Hide the new MarkerBadge - * - * @memberof ReportActionsView */ hideMarker() { this.setState({isMarkerActive: false}); @@ -386,15 +390,13 @@ class ReportActionsView extends React.Component { /** * keeps track of the Scroll offset of the main messages list * - * @param {*} {nativeEvent} - * @memberof ReportActionsView + * @param {Object} {nativeEvent} */ trackScroll({nativeEvent}) { this.currentScrollOffset = -nativeEvent.contentOffset.y; - this.showMarker(); + this.toggleMarker(); } - /** * Runs when the FlatList finishes laying out */ diff --git a/src/styles/styles.js b/src/styles/styles.js index 4ed9a6f784fb..9d08d9d5f3f3 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -1992,12 +1992,10 @@ const styles = { left: '50%', top: 0, zIndex: 100, - backfaceVisibility: 'hidden', ...visibility('hidden'), }, reportMarkerBadge: { - backfaceVisibility: 'visible', left: '-50%', ...visibility('visible'), },