Skip to content

Commit

Permalink
Merge pull request #20553 from allroundexperts/fix-20495
Browse files Browse the repository at this point in the history
fix: show cursor pointer for option row where no press function is given
  • Loading branch information
arosiclair committed Jun 9, 2023
2 parents 2381734 + ac263be commit 33fda84
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ function MoneyRequestConfirmationList(props) {
data: [formattedPayeePersonalDetails],
shouldShow: true,
indexOffset: 0,
isDisabled: true,
},
{
title: translate('moneyRequestConfirmationList.whoWasThere'),
Expand Down Expand Up @@ -296,7 +295,6 @@ function MoneyRequestConfirmationList(props) {
selectedOptions={selectedOptions}
canSelectMultipleOptions={canModifyParticipants}
disableArrowKeysActions={!canModifyParticipants}
isDisabled={!canModifyParticipants}
boldStyle
shouldTextInputAppearBelowOptions
shouldShowTextInput={false}
Expand Down
7 changes: 6 additions & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const defaultProps = {
isSelected: false,
boldStyle: false,
showTitleTooltip: false,
onSelectRow: () => {},
onSelectRow: undefined,
isDisabled: false,
optionIsFocused: false,
style: null,
Expand Down Expand Up @@ -151,6 +151,10 @@ class OptionRow extends Component {
<PressableWithFeedback
ref={(el) => (pressableRef = el)}
onPress={(e) => {
if (!this.props.onSelectRow) {
return;
}

this.setState({isDisabled: true});
if (e) {
e.preventDefault();
Expand All @@ -172,6 +176,7 @@ class OptionRow extends Component {
this.props.shouldDisableRowInnerPadding ? null : styles.sidebarLinkInner,
this.props.optionIsFocused ? styles.sidebarLinkActive : null,
this.props.shouldHaveOptionSeparator && styles.borderTop,
!this.props.onSelectRow && !this.props.isDisabled ? styles.cursorDefault : null,
]}
accessibilityLabel={this.props.option.text}
accessibilityRole="button"
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionsList/optionsListPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const defaultProps = {
hideSectionHeaders: false,
disableFocusOptions: false,
boldStyle: false,
onSelectRow: () => {},
onSelectRow: undefined,
headerMessage: '',
innerRef: null,
showTitleTooltip: false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class BaseOptionsSelector extends Component {
<OptionsList
ref={(el) => (this.list = el)}
optionHoveredStyle={this.props.optionHoveredStyle}
onSelectRow={this.selectRow}
onSelectRow={this.props.onSelectRow ? this.selectRow : undefined}
sections={this.props.sections}
focusedIndex={this.state.focusedIndex}
selectedOptions={this.props.selectedOptions}
Expand Down
2 changes: 1 addition & 1 deletion src/components/OptionsSelector/optionsSelectorPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const propTypes = {
};

const defaultProps = {
onSelectRow: () => {},
onSelectRow: undefined,
textInputLabel: '',
placeholderText: '',
keyboardType: 'default',
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 @@ -345,7 +345,6 @@ class WorkspaceMembersPage extends React.Component {
/>
<View style={styles.flex1}>
<OptionRow
isDisabled
boldStyle
option={{
text: this.props.formatPhoneNumber(item.displayName),
Expand All @@ -360,6 +359,7 @@ class WorkspaceMembersPage extends React.Component {
],
keyForList: item.login,
}}
onSelectRow={() => this.toggleUser(item.login, item.pendingAction)}
/>
</View>
{(this.props.session.email === item.login || item.role === 'admin') && (
Expand Down

0 comments on commit 33fda84

Please sign in to comment.