diff --git a/src/languages/en.js b/src/languages/en.js index 3f7caa694858..22a746f24070 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -135,6 +135,9 @@ export default { reportActionsView: { beFirstPersonToComment: 'Be the first person to comment', }, + reportActionsViewMarkerBadge: { + newMsg: ({count}) => `${count} new message${count > 1 ? 's' : ''}`, + }, reportTypingIndicator: { isTyping: 'is typing...', areTyping: 'are typing...', diff --git a/src/languages/es.js b/src/languages/es.js index c343397d1722..0dfd38895d84 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -135,6 +135,9 @@ export default { reportActionsView: { beFirstPersonToComment: 'Sé el primero en comentar', }, + reportActionsViewMarkerBadge: { + newMsg: ({count}) => `${count} mensaje${count > 1 ? 's' : ''} nuevo${count > 1 ? 's' : ''}`, + }, reportTypingIndicator: { isTyping: 'está escribiendo...', areTyping: 'están escribiendo...', diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index c782cb47bf72..1f6634aebb44 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -132,7 +132,10 @@ class ReportScreen extends React.Component { onNavigationMenuButtonClicked={() => Navigation.navigate(ROUTES.HOME)} /> - + {!this.shouldShowLoader() && } {this.props.session.shouldShowComposeInput && ( diff --git a/src/pages/home/report/MarkerBadge.js b/src/pages/home/report/MarkerBadge.js new file mode 100644 index 000000000000..f060f305dd05 --- /dev/null +++ b/src/pages/home/report/MarkerBadge.js @@ -0,0 +1,125 @@ +import React, {PureComponent} from 'react'; +import {Animated, Text, View} from 'react-native'; +import PropTypes from 'prop-types'; +import styles from '../../../styles/styles'; +import Button from '../../../components/Button'; +import Icon from '../../../components/Icon'; +import {Close, DownArrow} from '../../../components/Icon/Expensicons'; +import themeColors from '../../../styles/themes/default'; +import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; + +const MARKER_NOT_ACTIVE_TRANSLATE_Y = -30; +const MARKER_ACTIVE_TRANSLATE_Y = 10; +const propTypes = { + /** Count of new messages to show in the badge */ + count: PropTypes.number, + + /** Whether the marker is active */ + active: PropTypes.bool, + + /** Callback to be called when user closes the badge */ + onClose: PropTypes.func, + + /** Callback to be called when user clicks the marker */ + onClick: PropTypes.func, + + ...withLocalizePropTypes, +}; +const defaultProps = { + count: 0, + active: false, + onClose: () => {}, + onClick: () => {}, +}; +class MarkerBadge extends PureComponent { + constructor(props) { + super(props); + this.translateY = new Animated.Value(MARKER_NOT_ACTIVE_TRANSLATE_Y); + this.show = this.show.bind(this); + this.hide = this.hide.bind(this); + } + + componentDidUpdate() { + if (this.props.active && this.props.count > 0) { + this.show(); + } else { + this.hide(); + } + } + + show() { + Animated.spring(this.translateY, { + toValue: MARKER_ACTIVE_TRANSLATE_Y, + duration: 80, + useNativeDriver: true, + }).start(); + } + + hide() { + Animated.spring(this.translateY, { + toValue: MARKER_NOT_ACTIVE_TRANSLATE_Y, + duration: 80, + useNativeDriver: true, + }).start(); + } + + render() { + return ( + + + +