Skip to content

Commit

Permalink
fix: use unique props name
Browse files Browse the repository at this point in the history
  • Loading branch information
sangar-1028 committed Oct 10, 2023
1 parent 2b2d137 commit 1b94af4
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -98,7 +98,7 @@ const defaultProps = {
style: null,
shouldHaveOptionSeparator: false,
shouldDisableRowInnerPadding: false,
shouldPreventDefaultFocusOnSelect: false,
shouldPreventDefaultFocusOnSelectRow: false,
};

class OptionRow extends Component {
Expand Down Expand Up @@ -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}
>
<View style={sidebarInnerRowStyle}>
<View style={[styles.flexRow, styles.alignItemsCenter]}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/OptionsList/BaseOptionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function BaseOptionsList({
showScrollIndicator,
listContainerStyles,
shouldDisableRowInnerPadding,
shouldPreventDefaultFocusOnSelect,
shouldPreventDefaultFocusOnSelectRow,
disableFocusOptions,
canSelectMultipleOptions,
shouldShowMultipleOptionSelectorAsButton,
Expand Down Expand Up @@ -207,7 +207,7 @@ function BaseOptionsList({
isDisabled={isItemDisabled}
shouldHaveOptionSeparator={index > 0 && shouldHaveOptionSeparator}
shouldDisableRowInnerPadding={shouldDisableRowInnerPadding}
shouldPreventDefaultFocusOnSelect={shouldPreventDefaultFocusOnSelect}
shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow}
isMultilineSupported={isRowMultilineSupported}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/OptionsList/optionsListPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -110,7 +110,7 @@ const defaultProps = {
onLayout: undefined,
shouldHaveOptionSeparator: false,
shouldDisableRowInnerPadding: false,
shouldPreventDefaultFocusOnSelect: false,
shouldPreventDefaultFocusOnSelectRow: false,
showScrollIndicator: false,
isRowMultilineSupported: false,
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 (
Expand Down
6 changes: 3 additions & 3 deletions src/components/OptionsSelector/optionsSelectorPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -144,7 +144,7 @@ const defaultProps = {
hideSectionHeaders: false,
boldStyle: false,
showTitleTooltip: false,
shouldFocusOnSelectRow: false,
shouldPreventDefaultFocusOnSelectRow: false,
autoFocus: true,
shouldShowConfirmButton: false,
confirmButtonText: undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/components/SelectionList/BaseListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function BaseListItem({
isFocused = false,
isDisabled = false,
showTooltip,
shouldPreventDefaultFocusOnSelect = false,
shouldPreventDefaultFocusOnSelectRow = false,
canSelectMultiple = false,
onSelectRow,
onDismissError = () => {},
Expand All @@ -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}
>
<View
style={[
Expand Down
10 changes: 5 additions & 5 deletions src/components/SelectionList/BaseSelectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function BaseSelectionList({
showScrollIndicator = false,
showLoadingPlaceholder = false,
showConfirmButton = false,
shouldFocusOnSelectRow = false,
shouldPreventDefaultFocusOnSelectRow = false,
isKeyboardShown = false,
inputRef = null,
disableKeyboardShortcuts = false,
Expand Down Expand Up @@ -211,14 +211,14 @@ function BaseSelectionList({

onSelectRow(item);

if (shouldShowTextInput && shouldFocusOnSelectRow && textInputRef.current) {
if (shouldShowTextInput && shouldPreventDefaultFocusOnSelectRow && textInputRef.current) {
textInputRef.current.focus();
}
};

const selectAllRow = () => {
onSelectAll();
if (shouldShowTextInput && shouldFocusOnSelectRow && textInputRef.current) {
if (shouldShowTextInput && shouldPreventDefaultFocusOnSelectRow && textInputRef.current) {
textInputRef.current.focus();
}
};
Expand Down Expand Up @@ -299,7 +299,7 @@ function BaseSelectionList({
canSelectMultiple={canSelectMultiple}
onSelectRow={() => selectRow(item, true)}
onDismissError={onDismissError}
shouldPreventDefaultFocusOnSelect={shouldFocusOnSelectRow}
shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow}
/>
);
};
Expand Down Expand Up @@ -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}
>
<Checkbox
accessibilityLabel={translate('workspace.people.selectAll')}
Expand Down
6 changes: 3 additions & 3 deletions src/components/SelectionList/selectionListPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const radioListItemPropTypes = {
const baseListItemPropTypes = {
...commonListItemPropTypes,
item: PropTypes.oneOfType([PropTypes.shape(userListItemPropTypes.item), PropTypes.shape(radioListItemPropTypes.item)]),
shouldPreventDefaultFocusOnSelect: PropTypes.bool,
shouldPreventDefaultFocusOnSelectRow: PropTypes.bool,
};

const propTypes = {
Expand Down Expand Up @@ -168,8 +168,8 @@ const propTypes = {
/** Whether to show the default confirm button */
showConfirmButton: 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,

/** A ref to forward to the TextInput */
inputRef: PropTypes.oneOfType([PropTypes.object]),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function NewChatPage({betas, isGroupChat, personalDetails, reports, translate})
onChangeText={setSearchTerm}
headerMessage={headerMessage}
boldStyle
shouldFocusOnSelectRow={!Browser.isMobile()}
shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()}
shouldShowOptions={isOptionsDataReady}
shouldShowConfirmButton
confirmButtonText={selectedOptions.length > 1 ? translate('newChatPage.createGroup') : translate('newChatPage.createChat')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function MoneyRequestParticipantsSelector({
textInputLabel={translate('optionsSelector.nameEmailOrPhoneNumber')}
safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle}
shouldShowOptions={isOptionsDataReady}
shouldFocusOnSelectRow={!Browser.isMobile()}
shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()}
shouldDelayFocus
/>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInvitePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function WorkspaceInvitePage(props) {
onConfirm={inviteUser}
showScrollIndicator
showLoadingPlaceholder={!didScreenTransitionEnd || !OptionsListUtils.isPersonalDetailsReady(props.personalDetails)}
shouldFocusOnSelectRow={!Browser.isMobile()}
shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()}
/>
<View style={[styles.flexShrink0]}>
<FormAlertWithSubmitButton
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function WorkspaceMembersPage(props) {
onDismissError={dismissError}
showLoadingPlaceholder={!OptionsListUtils.isPersonalDetailsReady(props.personalDetails) || _.isEmpty(props.policyMembers)}
showScrollIndicator
shouldFocusOnSelectRow={!Browser.isMobile()}
shouldPreventDefaultFocusOnSelectRow={!Browser.isMobile()}
inputRef={textInputRef}
/>
</View>
Expand Down

0 comments on commit 1b94af4

Please sign in to comment.