From 4ab678011938e1e34714d3af360a71a6f2d78259 Mon Sep 17 00:00:00 2001 From: maftalion Date: Mon, 22 Feb 2021 22:39:44 -0800 Subject: [PATCH 1/8] refactor CreateMenu to have dynamic items --- assets/images/money-circle.svg | 12 +++ assets/images/receipt.svg | 9 +++ src/components/CreateMenu.js | 84 ++++++++++++++------ src/components/Icon/Expensicons.js | 4 + src/pages/home/ReportScreen.js | 1 + src/pages/home/report/ReportActionCompose.js | 62 ++++++++++----- src/pages/home/report/ReportView.js | 4 + src/pages/home/sidebar/SidebarScreen.js | 9 ++- 8 files changed, 142 insertions(+), 43 deletions(-) create mode 100644 assets/images/money-circle.svg create mode 100644 assets/images/receipt.svg diff --git a/assets/images/money-circle.svg b/assets/images/money-circle.svg new file mode 100644 index 000000000000..eb1bf4488874 --- /dev/null +++ b/assets/images/money-circle.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/assets/images/receipt.svg b/assets/images/receipt.svg new file mode 100644 index 000000000000..90b88db8c62a --- /dev/null +++ b/assets/images/receipt.svg @@ -0,0 +1,9 @@ + + + + + diff --git a/src/components/CreateMenu.js b/src/components/CreateMenu.js index 7f3b3c8f4ebb..f96d20883e3f 100644 --- a/src/components/CreateMenu.js +++ b/src/components/CreateMenu.js @@ -8,11 +8,21 @@ import styles from '../styles/styles'; import CONST from '../CONST'; import themeColors from '../styles/themes/default'; import Icon from './Icon'; -import {ChatBubble, Users} from './Icon/Expensicons'; +import { + ChatBubble, Users, Receipt, MoneyCircle, Paperclip, +} from './Icon/Expensicons'; import {redirect} from '../libs/actions/App'; import ROUTES from '../ROUTES'; import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions'; +export const MENU_ITEM_KEYS = { + NewChat: 'NewChat', + NewGroup: 'NewGroup', + RequestMoney: 'RequestMoney', + SplitBill: 'SplitBill', + AttachmentPicker: 'AttachmentPicker', +}; + const propTypes = { // Callback to fire on request to modal close onClose: PropTypes.func.isRequired, @@ -23,9 +33,21 @@ const propTypes = { // Callback to fire when a CreateMenu item is selected onItemSelected: PropTypes.func.isRequired, + // Menu items to be rendered on the list + menuOptions: PropTypes.arrayOf( + PropTypes.oneOf(Object.keys(MENU_ITEM_KEYS)), + ).isRequired, + + // Callback to fire when a AttachmentPicker item is selected + onAttachmentPickerSelected: PropTypes.func, + ...windowDimensionsPropTypes, }; +const defaultProps = { + onAttachmentPickerSelected: () => {}, +}; + class CreateMenu extends PureComponent { constructor(props) { super(props); @@ -33,6 +55,42 @@ class CreateMenu extends PureComponent { this.setOnModalHide = this.setOnModalHide.bind(this); this.resetOnModalHide = this.resetOnModalHide.bind(this); this.onModalHide = () => {}; + + const MENU_ITEMS = { + [MENU_ITEM_KEYS.NewChat]: { + icon: ChatBubble, + text: 'New Chat', + onSelected: () => redirect(ROUTES.NEW_CHAT), + }, + [MENU_ITEM_KEYS.NewGroup]: { + icon: Users, + text: 'New Group', + onSelected: () => redirect(ROUTES.NEW_GROUP), + }, + [MENU_ITEM_KEYS.RequestMoney]: { + icon: MoneyCircle, + text: 'Request Money', + onSelected: () => redirect(ROUTES.NEW_CHAT), + }, + [MENU_ITEM_KEYS.SplitBill]: { + icon: Receipt, + text: 'Split Bill', + onSelected: () => redirect(ROUTES.NEW_CHAT), + }, + [MENU_ITEM_KEYS.AttachmentPicker]: { + icon: Paperclip, + text: 'Add Attachment', + onSelected: () => this.props.onAttachmentPickerSelected(), + }, + }; + + this.menuItemData = props.menuOptions.map(key => ({ + ...MENU_ITEMS[key], + onPress: () => { + props.onItemSelected(); + this.setOnModalHide(() => MENU_ITEMS[key].onSelected()); + }, + })); } /** @@ -51,27 +109,6 @@ class CreateMenu extends PureComponent { } render() { - // This format allows to set individual callbacks to each item - // while including mutual callbacks first - const menuItemData = [ - { - icon: ChatBubble, - text: 'New Chat', - onPress: () => this.setOnModalHide(() => redirect(ROUTES.NEW_CHAT)), - }, - { - icon: Users, - text: 'New Group', - onPress: () => this.setOnModalHide(() => redirect(ROUTES.NEW_GROUP)), - }, - ].map(item => ({ - ...item, - onPress: () => { - this.props.onItemSelected(); - item.onPress(); - }, - })); - return ( - {menuItemData.map(({icon, text, onPress}) => ( + {this.menuItemData.map(({icon, text, onPress}) => ( 1} /> ))} diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 9898c2024872..bd5390363b8c 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -16,6 +16,7 @@ import ReportTypingIndicator from './ReportTypingIndicator'; import AttachmentModal from '../../../components/AttachmentModal'; import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; import compose from '../../../libs/compose'; +import CreateMenu, {MENU_ITEM_KEYS} from '../../../components/CreateMenu'; const propTypes = { // A method to call when the form is submitted @@ -29,6 +30,9 @@ const propTypes = { isSidebarShown: PropTypes.bool.isRequired, + // Whether or not this report has more than one participant + hasMultipleParticipants: PropTypes.bool.isRequired, + ...windowDimensionsPropTypes, }; @@ -39,7 +43,6 @@ const defaultProps = { class ReportActionCompose extends React.Component { constructor(props) { super(props); - this.updateComment = this.updateComment.bind(this); this.debouncedSaveReportComment = _.debounce(this.debouncedSaveReportComment.bind(this), 1000, false); this.debouncedBroadcastUserIsTyping = _.debounce(() => broadcastUserIsTyping(props.reportID), 100, true); @@ -53,6 +56,7 @@ class ReportActionCompose extends React.Component { isFocused: false, textInputShouldClear: false, isCommentEmpty: props.comment.length === 0, + isMenuVisible: false, }; } @@ -82,6 +86,15 @@ class ReportActionCompose extends React.Component { this.setState({textInputShouldClear: shouldClear}); } + /** + * Updates the visiblity state of the menu + * + * @param {Boolean} isMenuVisible + */ + setMenuVisibility(isMenuVisible) { + this.setState({isMenuVisible}); + } + /** * Save our report comment in Onyx. We debounce this method in the constructor so that it's not called too often * to update Onyx and re-render this component. @@ -168,24 +181,35 @@ class ReportActionCompose extends React.Component { <> {({openPicker}) => ( - { - e.preventDefault(); - - // Do not open attachment picker from keypress event - if (!e.key) { - openPicker({ - onPicked: (file) => { - displayFileInModal({file}); - }, - }); - } - }} - style={[styles.chatItemAttachButton]} - underlayColor={themeColors.componentBG} - > - - + <> + { + e.preventDefault(); + this.setMenuVisibility(true); + }} + style={styles.chatItemAttachButton} + underlayColor={themeColors.componentBG} + > + + + this.setMenuVisibility(false)} + onAttachmentPickerSelected={() => { + setTimeout(() => { + openPicker({ + onPicked: (file) => { + displayFileInModal({file}); + }, + }); + }, 100); + }} + onItemSelected={() => this.setMenuVisibility(false)} + menuOptions={this.props.hasMultipleParticipants + ? [MENU_ITEM_KEYS.SplitBill, MENU_ITEM_KEYS.AttachmentPicker] + : [MENU_ITEM_KEYS.RequestMoney, MENU_ITEM_KEYS.AttachmentPicker]} + /> + )} addAction(this.props.reportID, text)} reportID={this.props.reportID} + hasMultipleParticipants={this.props.hasMultipleParticipants} /> )} diff --git a/src/pages/home/sidebar/SidebarScreen.js b/src/pages/home/sidebar/SidebarScreen.js index d6b3eaf8cadd..886380d2c475 100644 --- a/src/pages/home/sidebar/SidebarScreen.js +++ b/src/pages/home/sidebar/SidebarScreen.js @@ -3,10 +3,11 @@ import {View} from 'react-native'; import PropTypes from 'prop-types'; import styles from '../../../styles/styles'; import SidebarLinks from './SidebarLinks'; -import CreateMenu from '../../../components/CreateMenu'; +import CreateMenu, {MENU_ITEM_KEYS} from '../../../components/CreateMenu'; import FAB from '../../../components/FAB'; import ScreenWrapper from '../../../components/ScreenWrapper'; + const propTypes = { // Toggles the navigation menu open and closed onLinkClick: PropTypes.func.isRequired, @@ -45,6 +46,12 @@ const SidebarScreen = props => ( onClose={props.toggleCreateMenu} isVisible={props.isCreateMenuActive} onItemSelected={props.onCreateMenuItemSelected} + menuOptions={[ + MENU_ITEM_KEYS.NewChat, + MENU_ITEM_KEYS.RequestMoney, + MENU_ITEM_KEYS.NewGroup, + MENU_ITEM_KEYS.SplitBill, + ]} /> )} From a73e58d1147bc265f27f3af9132fd5f2a4cd21eb Mon Sep 17 00:00:00 2001 From: maftalion Date: Tue, 23 Feb 2021 18:56:51 -0800 Subject: [PATCH 2/8] refactor menu items into CONST --- src/CONST.js | 7 +++++++ src/components/CreateMenu.js | 19 ++++++------------- src/pages/home/report/ReportActionCompose.js | 11 ++++++++--- src/pages/home/sidebar/SidebarScreen.js | 11 ++++++----- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index d9eac2352374..51eed00d08e3 100644 --- a/src/CONST.js +++ b/src/CONST.js @@ -39,6 +39,13 @@ const CONST = { ERROR: { API_OFFLINE: 'API is offline', }, + MENU_ITEM_KEYS: { + NEW_CHAT: 'NewChat', + NEW_GROUP: 'NewGroup', + REQUEST_MONEY: 'RequestMoney', + SPLIT_BILL: 'SplitBill', + ATTACHMENT_PICKER: 'AttachmentPicker', + }, }; export default CONST; diff --git a/src/components/CreateMenu.js b/src/components/CreateMenu.js index f96d20883e3f..ff06f8b4f875 100644 --- a/src/components/CreateMenu.js +++ b/src/components/CreateMenu.js @@ -15,13 +15,6 @@ import {redirect} from '../libs/actions/App'; import ROUTES from '../ROUTES'; import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions'; -export const MENU_ITEM_KEYS = { - NewChat: 'NewChat', - NewGroup: 'NewGroup', - RequestMoney: 'RequestMoney', - SplitBill: 'SplitBill', - AttachmentPicker: 'AttachmentPicker', -}; const propTypes = { // Callback to fire on request to modal close @@ -35,7 +28,7 @@ const propTypes = { // Menu items to be rendered on the list menuOptions: PropTypes.arrayOf( - PropTypes.oneOf(Object.keys(MENU_ITEM_KEYS)), + PropTypes.oneOf(Object.values(CONST.MENU_ITEM_KEYS)), ).isRequired, // Callback to fire when a AttachmentPicker item is selected @@ -57,27 +50,27 @@ class CreateMenu extends PureComponent { this.onModalHide = () => {}; const MENU_ITEMS = { - [MENU_ITEM_KEYS.NewChat]: { + [CONST.MENU_ITEM_KEYS.NEW_CHAT]: { icon: ChatBubble, text: 'New Chat', onSelected: () => redirect(ROUTES.NEW_CHAT), }, - [MENU_ITEM_KEYS.NewGroup]: { + [CONST.MENU_ITEM_KEYS.NEW_GROUP]: { icon: Users, text: 'New Group', onSelected: () => redirect(ROUTES.NEW_GROUP), }, - [MENU_ITEM_KEYS.RequestMoney]: { + [CONST.MENU_ITEM_KEYS.REQUEST_MONEY]: { icon: MoneyCircle, text: 'Request Money', onSelected: () => redirect(ROUTES.NEW_CHAT), }, - [MENU_ITEM_KEYS.SplitBill]: { + [CONST.MENU_ITEM_KEYS.SPLIT_BILL]: { icon: Receipt, text: 'Split Bill', onSelected: () => redirect(ROUTES.NEW_CHAT), }, - [MENU_ITEM_KEYS.AttachmentPicker]: { + [CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER]: { icon: Paperclip, text: 'Add Attachment', onSelected: () => this.props.onAttachmentPickerSelected(), diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index bd5390363b8c..34a09da8ab09 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -16,7 +16,8 @@ import ReportTypingIndicator from './ReportTypingIndicator'; import AttachmentModal from '../../../components/AttachmentModal'; import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; import compose from '../../../libs/compose'; -import CreateMenu, {MENU_ITEM_KEYS} from '../../../components/CreateMenu'; +import CreateMenu from '../../../components/CreateMenu'; +import CONST from '../../../CONST'; const propTypes = { // A method to call when the form is submitted @@ -206,8 +207,12 @@ class ReportActionCompose extends React.Component { }} onItemSelected={() => this.setMenuVisibility(false)} menuOptions={this.props.hasMultipleParticipants - ? [MENU_ITEM_KEYS.SplitBill, MENU_ITEM_KEYS.AttachmentPicker] - : [MENU_ITEM_KEYS.RequestMoney, MENU_ITEM_KEYS.AttachmentPicker]} + ? [ + CONST.MENU_ITEM_KEYS.SPLIT_BILL, + CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER] + : [ + CONST.MENU_ITEM_KEYS.REQUEST_MONEY, + CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER]} /> )} diff --git a/src/pages/home/sidebar/SidebarScreen.js b/src/pages/home/sidebar/SidebarScreen.js index 886380d2c475..a843e2e58237 100644 --- a/src/pages/home/sidebar/SidebarScreen.js +++ b/src/pages/home/sidebar/SidebarScreen.js @@ -3,9 +3,10 @@ import {View} from 'react-native'; import PropTypes from 'prop-types'; import styles from '../../../styles/styles'; import SidebarLinks from './SidebarLinks'; -import CreateMenu, {MENU_ITEM_KEYS} from '../../../components/CreateMenu'; +import CreateMenu from '../../../components/CreateMenu'; import FAB from '../../../components/FAB'; import ScreenWrapper from '../../../components/ScreenWrapper'; +import CONST from '../../../CONST'; const propTypes = { @@ -47,10 +48,10 @@ const SidebarScreen = props => ( isVisible={props.isCreateMenuActive} onItemSelected={props.onCreateMenuItemSelected} menuOptions={[ - MENU_ITEM_KEYS.NewChat, - MENU_ITEM_KEYS.RequestMoney, - MENU_ITEM_KEYS.NewGroup, - MENU_ITEM_KEYS.SplitBill, + CONST.MENU_ITEM_KEYS.NEW_CHAT, + CONST.MENU_ITEM_KEYS.REQUEST_MONEY, + CONST.MENU_ITEM_KEYS.NEW_GROUP, + CONST.MENU_ITEM_KEYS.SPLIT_BILL, ]} /> From ff2c70d466ccf0f92f0bc6ea7ee1ce53b8ab2615 Mon Sep 17 00:00:00 2001 From: maftalion Date: Tue, 23 Feb 2021 19:11:56 -0800 Subject: [PATCH 3/8] add missing import --- src/components/CreateMenu.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/CreateMenu.js b/src/components/CreateMenu.js index 0ec8b7a1742f..8ea597120743 100644 --- a/src/components/CreateMenu.js +++ b/src/components/CreateMenu.js @@ -13,6 +13,7 @@ import { import {redirect} from '../libs/actions/App'; import ROUTES from '../ROUTES'; import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions'; +import CONST from '../CONST'; const propTypes = { From 728bca0a172fec5682122e0a3ff8af5ee6b93636 Mon Sep 17 00:00:00 2001 From: maftalion Date: Wed, 24 Feb 2021 08:05:37 -0800 Subject: [PATCH 4/8] update menu visibility logic --- src/pages/home/report/ReportActionCompose.js | 44 ++++++++++---------- src/pages/home/sidebar/SidebarScreen.js | 24 ++++++----- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 34a09da8ab09..cb9aae00cb48 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -193,27 +193,29 @@ class ReportActionCompose extends React.Component { > - this.setMenuVisibility(false)} - onAttachmentPickerSelected={() => { - setTimeout(() => { - openPicker({ - onPicked: (file) => { - displayFileInModal({file}); - }, - }); - }, 100); - }} - onItemSelected={() => this.setMenuVisibility(false)} - menuOptions={this.props.hasMultipleParticipants - ? [ - CONST.MENU_ITEM_KEYS.SPLIT_BILL, - CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER] - : [ - CONST.MENU_ITEM_KEYS.REQUEST_MONEY, - CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER]} - /> + {this.state.isMenuVisible ? ( + this.setMenuVisibility(false)} + onAttachmentPickerSelected={() => { + setTimeout(() => { + openPicker({ + onPicked: (file) => { + displayFileInModal({file}); + }, + }); + }, 100); + }} + onItemSelected={() => this.setMenuVisibility(false)} + menuOptions={this.props.hasMultipleParticipants + ? [ + CONST.MENU_ITEM_KEYS.SPLIT_BILL, + CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER] + : [ + CONST.MENU_ITEM_KEYS.REQUEST_MONEY, + CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER]} + /> + ) : null} )} diff --git a/src/pages/home/sidebar/SidebarScreen.js b/src/pages/home/sidebar/SidebarScreen.js index a7c50758e915..534f5b32cf0c 100644 --- a/src/pages/home/sidebar/SidebarScreen.js +++ b/src/pages/home/sidebar/SidebarScreen.js @@ -168,17 +168,19 @@ class SidebarScreen extends Component { onPress={this.toggleCreateMenu} /> - + {this.state.isCreateMenuActive ? ( + + ) : null} )} From 8d4ecfa8803dcc6743369fadb1bc4a5afc1fd09c Mon Sep 17 00:00:00 2001 From: maftalion Date: Thu, 25 Feb 2021 16:03:11 -0800 Subject: [PATCH 5/8] revert conditional rendering of menu --- src/pages/home/report/ReportActionCompose.js | 44 ++++++++++---------- src/pages/home/sidebar/SidebarScreen.js | 24 +++++------ 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index cb9aae00cb48..34a09da8ab09 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -193,29 +193,27 @@ class ReportActionCompose extends React.Component { > - {this.state.isMenuVisible ? ( - this.setMenuVisibility(false)} - onAttachmentPickerSelected={() => { - setTimeout(() => { - openPicker({ - onPicked: (file) => { - displayFileInModal({file}); - }, - }); - }, 100); - }} - onItemSelected={() => this.setMenuVisibility(false)} - menuOptions={this.props.hasMultipleParticipants - ? [ - CONST.MENU_ITEM_KEYS.SPLIT_BILL, - CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER] - : [ - CONST.MENU_ITEM_KEYS.REQUEST_MONEY, - CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER]} - /> - ) : null} + this.setMenuVisibility(false)} + onAttachmentPickerSelected={() => { + setTimeout(() => { + openPicker({ + onPicked: (file) => { + displayFileInModal({file}); + }, + }); + }, 100); + }} + onItemSelected={() => this.setMenuVisibility(false)} + menuOptions={this.props.hasMultipleParticipants + ? [ + CONST.MENU_ITEM_KEYS.SPLIT_BILL, + CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER] + : [ + CONST.MENU_ITEM_KEYS.REQUEST_MONEY, + CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER]} + /> )} diff --git a/src/pages/home/sidebar/SidebarScreen.js b/src/pages/home/sidebar/SidebarScreen.js index 534f5b32cf0c..a7c50758e915 100644 --- a/src/pages/home/sidebar/SidebarScreen.js +++ b/src/pages/home/sidebar/SidebarScreen.js @@ -168,19 +168,17 @@ class SidebarScreen extends Component { onPress={this.toggleCreateMenu} /> - {this.state.isCreateMenuActive ? ( - - ) : null} + )} From c288639ebf0915ff0f43830f564049a713f6ce89 Mon Sep 17 00:00:00 2001 From: maftalion Date: Sat, 27 Feb 2021 08:12:01 -0800 Subject: [PATCH 6/8] update to use plus icon --- src/pages/home/report/ReportActionCompose.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 34a09da8ab09..930140acaa04 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -9,7 +9,7 @@ import themeColors from '../../../styles/themes/default'; import TextInputFocusable from '../../../components/TextInputFocusable'; import ONYXKEYS from '../../../ONYXKEYS'; import Icon from '../../../components/Icon'; -import {Paperclip, Send} from '../../../components/Icon/Expensicons'; +import {Plus, Send} from '../../../components/Icon/Expensicons'; import AttachmentPicker from '../../../components/AttachmentPicker'; import {addAction, saveReportComment, broadcastUserIsTyping} from '../../../libs/actions/Report'; import ReportTypingIndicator from './ReportTypingIndicator'; @@ -191,7 +191,7 @@ class ReportActionCompose extends React.Component { style={styles.chatItemAttachButton} underlayColor={themeColors.componentBG} > - + Date: Fri, 19 Mar 2021 09:28:55 -0700 Subject: [PATCH 7/8] fix merge conflicts --- src/components/CreateMenu.js | 2 +- src/pages/home/report/ReportActionCompose.js | 26 +++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/CreateMenu.js b/src/components/CreateMenu.js index 6704f1ae4798..da57ef5dbf78 100644 --- a/src/components/CreateMenu.js +++ b/src/components/CreateMenu.js @@ -109,7 +109,7 @@ class CreateMenu extends PureComponent { anchorPosition={styles.createMenuPosition} > - {menuItemData.map(({icon, text, onPress}) => ( + {this.menuItemData.map(({icon, text, onPress}) => ( 1; return ( @@ -228,7 +245,7 @@ class ReportActionCompose extends React.Component { }, 100); }} onItemSelected={() => this.setMenuVisibility(false)} - menuOptions={this.props.hasMultipleParticipants + menuOptions={hasMultipleParticipants ? [ CONST.MENU_ITEM_KEYS.SPLIT_BILL, CONST.MENU_ITEM_KEYS.ATTACHMENT_PICKER] @@ -302,6 +319,9 @@ export default compose( modal: { key: ONYXKEYS.MODAL, }, + report: { + key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, + }, }), withWindowDimensions, )(ReportActionCompose); From 801f92ab4cb66e0b0fab76c933830f02a8bc7e51 Mon Sep 17 00:00:00 2001 From: maftalion Date: Fri, 19 Mar 2021 09:54:19 -0700 Subject: [PATCH 8/8] reduce time, fix proptype --- src/pages/home/report/ReportActionCompose.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index f1f1b4fc68a5..d6374069b4fa 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -40,21 +40,9 @@ const propTypes = { report: PropTypes.shape({ // participants associated with current report - participants: PropTypes.arrayOf(PropTypes.shape({ - login: PropTypes.string.isRequired, - alternateText: PropTypes.string, - hasDraftComment: PropTypes.bool, - icons: PropTypes.arrayOf(PropTypes.string), - searchText: PropTypes.string, - text: PropTypes.string, - keyForList: PropTypes.string, - isPinned: PropTypes.bool, - isUnread: PropTypes.bool, - reportID: PropTypes.number, - })), + participants: PropTypes.arrayOf(PropTypes.string), }).isRequired, - ...windowDimensionsPropTypes, }; @@ -242,7 +230,7 @@ class ReportActionCompose extends React.Component { displayFileInModal({file}); }, }); - }, 100); + }, 10); }} onItemSelected={() => this.setMenuVisibility(false)} menuOptions={hasMultipleParticipants