Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show cursor pointer for option row where no press function is given #20553

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -67,7 +67,7 @@ const defaultProps = {
isSelected: false,
boldStyle: false,
showTitleTooltip: false,
onSelectRow: () => {},
onSelectRow: undefined,
isDisabled: false,
optionIsFocused: false,
style: null,
Expand Down Expand Up @@ -150,6 +150,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 @@ -171,6 +175,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
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