From 1b94af4f5a9976865695d7c235a0054d81ddac6c Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Tue, 10 Oct 2023 10:02:21 -0500 Subject: [PATCH] fix: use unique props name --- src/components/OptionRow.js | 6 +++--- src/components/OptionsList/BaseOptionsList.js | 4 ++-- src/components/OptionsList/optionsListPropTypes.js | 4 ++-- src/components/OptionsSelector/BaseOptionsSelector.js | 8 ++++---- .../OptionsSelector/optionsSelectorPropTypes.js | 6 +++--- src/components/SelectionList/BaseListItem.js | 4 ++-- src/components/SelectionList/BaseSelectionList.js | 10 +++++----- src/components/SelectionList/selectionListPropTypes.js | 6 +++--- src/pages/NewChatPage.js | 2 +- .../MoneyRequestParticipantsSelector.js | 2 +- src/pages/workspace/WorkspaceInvitePage.js | 2 +- src/pages/workspace/WorkspaceMembersPage.js | 2 +- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/components/OptionRow.js b/src/components/OptionRow.js index 1aa7e4c200ef..ec6891720b55 100644 --- a/src/components/OptionRow.js +++ b/src/components/OptionRow.js @@ -71,7 +71,7 @@ const propTypes = { shouldDisableRowInnerPadding: PropTypes.bool, /** Whether to prevent default focusing on select */ - shouldPreventDefaultFocusOnSelect: PropTypes.bool, + shouldPreventDefaultFocusOnSelectRow: PropTypes.bool, /** Whether to wrap large text up to 2 lines */ isMultilineSupported: PropTypes.bool, @@ -98,7 +98,7 @@ const defaultProps = { style: null, shouldHaveOptionSeparator: false, shouldDisableRowInnerPadding: false, - shouldPreventDefaultFocusOnSelect: false, + shouldPreventDefaultFocusOnSelectRow: false, }; class OptionRow extends Component { @@ -217,7 +217,7 @@ class OptionRow extends Component { hoverDimmingValue={1} hoverStyle={this.props.hoverStyle} needsOffscreenAlphaCompositing={lodashGet(this.props.option, 'icons.length', 0) >= 2} - onMouseDown={this.props.shouldPreventDefaultFocusOnSelect ? (e) => e.preventDefault() : undefined} + onMouseDown={this.props.shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} > diff --git a/src/components/OptionsList/BaseOptionsList.js b/src/components/OptionsList/BaseOptionsList.js index 16cd220c3985..23049b65f198 100644 --- a/src/components/OptionsList/BaseOptionsList.js +++ b/src/components/OptionsList/BaseOptionsList.js @@ -54,7 +54,7 @@ function BaseOptionsList({ showScrollIndicator, listContainerStyles, shouldDisableRowInnerPadding, - shouldPreventDefaultFocusOnSelect, + shouldPreventDefaultFocusOnSelectRow, disableFocusOptions, canSelectMultipleOptions, shouldShowMultipleOptionSelectorAsButton, @@ -207,7 +207,7 @@ function BaseOptionsList({ isDisabled={isItemDisabled} shouldHaveOptionSeparator={index > 0 && shouldHaveOptionSeparator} shouldDisableRowInnerPadding={shouldDisableRowInnerPadding} - shouldPreventDefaultFocusOnSelect={shouldPreventDefaultFocusOnSelect} + shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} isMultilineSupported={isRowMultilineSupported} /> ); diff --git a/src/components/OptionsList/optionsListPropTypes.js b/src/components/OptionsList/optionsListPropTypes.js index 956bcb5fc55a..165cec699b80 100644 --- a/src/components/OptionsList/optionsListPropTypes.js +++ b/src/components/OptionsList/optionsListPropTypes.js @@ -80,7 +80,7 @@ const propTypes = { shouldDisableRowInnerPadding: PropTypes.bool, /** Whether to prevent default focusing when selecting a row */ - shouldPreventDefaultFocusOnSelect: PropTypes.bool, + shouldPreventDefaultFocusOnSelectRow: PropTypes.bool, /** Whether to show the scroll bar */ showScrollIndicator: PropTypes.bool, @@ -110,7 +110,7 @@ const defaultProps = { onLayout: undefined, shouldHaveOptionSeparator: false, shouldDisableRowInnerPadding: false, - shouldPreventDefaultFocusOnSelect: false, + shouldPreventDefaultFocusOnSelectRow: false, showScrollIndicator: false, isRowMultilineSupported: false, }; diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js index 9548a92ceee4..183ddb20c87b 100755 --- a/src/components/OptionsSelector/BaseOptionsSelector.js +++ b/src/components/OptionsSelector/BaseOptionsSelector.js @@ -316,7 +316,7 @@ class BaseOptionsSelector extends Component { */ selectRow(option, ref) { return new Promise((resolve) => { - if (this.props.shouldShowTextInput && this.props.shouldFocusOnSelectRow) { + if (this.props.shouldShowTextInput && this.props.shouldPreventDefaultFocusOnSelectRow) { if (this.relatedTarget && ref === this.relatedTarget) { this.textInput.focus(); this.relatedTarget = null; @@ -344,7 +344,7 @@ class BaseOptionsSelector extends Component { * @param {Object} option */ addToSelection(option) { - if (this.props.shouldShowTextInput && this.props.shouldFocusOnSelectRow) { + if (this.props.shouldShowTextInput && this.props.shouldPreventDefaultFocusOnSelectRow) { this.textInput.focus(); if (this.textInput.isFocused()) { setSelection(this.textInput, 0, this.props.value.length); @@ -372,7 +372,7 @@ class BaseOptionsSelector extends Component { maxLength={this.props.maxLength} keyboardType={this.props.keyboardType} onBlur={(e) => { - if (!this.props.shouldFocusOnSelectRow) { + if (!this.props.shouldPreventDefaultFocusOnSelectRow) { return; } this.relatedTarget = e.relatedTarget; @@ -417,7 +417,7 @@ class BaseOptionsSelector extends Component { isLoading={!this.props.shouldShowOptions} showScrollIndicator={this.props.showScrollIndicator} isRowMultilineSupported={this.props.isRowMultilineSupported} - shouldPreventDefaultFocusOnSelect={this.props.shouldFocusOnSelectRow} + shouldPreventDefaultFocusOnSelectRow={this.props.shouldPreventDefaultFocusOnSelectRow} /> ); return ( diff --git a/src/components/OptionsSelector/optionsSelectorPropTypes.js b/src/components/OptionsSelector/optionsSelectorPropTypes.js index 8a7158092967..2eaa727b0f25 100644 --- a/src/components/OptionsSelector/optionsSelectorPropTypes.js +++ b/src/components/OptionsSelector/optionsSelectorPropTypes.js @@ -80,8 +80,8 @@ const propTypes = { /** Whether to show the title tooltip */ showTitleTooltip: PropTypes.bool, - /** Whether to focus the textinput after an option is selected */ - shouldFocusOnSelectRow: PropTypes.bool, + /** Whether to prevent default focusing of options and focus the textinput when selecting an option */ + shouldPreventDefaultFocusOnSelectRow: PropTypes.bool, /** Whether to autofocus the search input on mount */ autoFocus: PropTypes.bool, @@ -144,7 +144,7 @@ const defaultProps = { hideSectionHeaders: false, boldStyle: false, showTitleTooltip: false, - shouldFocusOnSelectRow: false, + shouldPreventDefaultFocusOnSelectRow: false, autoFocus: true, shouldShowConfirmButton: false, confirmButtonText: undefined, diff --git a/src/components/SelectionList/BaseListItem.js b/src/components/SelectionList/BaseListItem.js index cbf9265fd95d..171a58ee9fa9 100644 --- a/src/components/SelectionList/BaseListItem.js +++ b/src/components/SelectionList/BaseListItem.js @@ -18,7 +18,7 @@ function BaseListItem({ isFocused = false, isDisabled = false, showTooltip, - shouldPreventDefaultFocusOnSelect = false, + shouldPreventDefaultFocusOnSelectRow = false, canSelectMultiple = false, onSelectRow, onDismissError = () => {}, @@ -41,7 +41,7 @@ function BaseListItem({ hoverDimmingValue={1} hoverStyle={styles.hoveredComponentBG} dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}} - onMouseDown={shouldPreventDefaultFocusOnSelect ? (e) => e.preventDefault() : undefined} + onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} > { onSelectAll(); - if (shouldShowTextInput && shouldFocusOnSelectRow && textInputRef.current) { + if (shouldShowTextInput && shouldPreventDefaultFocusOnSelectRow && textInputRef.current) { textInputRef.current.focus(); } }; @@ -299,7 +299,7 @@ function BaseSelectionList({ canSelectMultiple={canSelectMultiple} onSelectRow={() => selectRow(item, true)} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelect={shouldFocusOnSelectRow} + shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} /> ); }; @@ -402,7 +402,7 @@ function BaseSelectionList({ accessibilityState={{checked: flattenedSections.allSelected}} disabled={flattenedSections.allOptions.length === flattenedSections.disabledOptionsIndexes.length} dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}} - onMouseDown={shouldFocusOnSelectRow ? (e) => e.preventDefault() : undefined} + onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} > 1 ? translate('newChatPage.createGroup') : translate('newChatPage.createChat')} diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 05b206ce4147..3ad214b54b20 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -268,7 +268,7 @@ function MoneyRequestParticipantsSelector({ textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')} safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} shouldShowOptions={isOptionsDataReady} - shouldFocusOnSelectRow={!Browser.isMobile()} + shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()} shouldDelayFocus /> diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index b787e00e79d4..e7bbd9657e8b 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -232,7 +232,7 @@ function WorkspaceInvitePage(props) { onConfirm={inviteUser} showScrollIndicator showLoadingPlaceholder={!didScreenTransitionEnd || !OptionsListUtils.isPersonalDetailsReady(props.personalDetails)} - shouldFocusOnSelectRow={!Browser.isMobile()} + shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()} />