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 crash when opening a split bill preview on an #announce room #31291

Merged
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
6 changes: 4 additions & 2 deletions src/components/ReportActionItem/MoneyRequestPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,17 @@ function MoneyRequestPreview(props) {
return childContainer;
}

const shouldDisableOnPress = props.isBillSplit && _.isEmpty(props.transaction);

return (
<PressableWithFeedback
onPress={props.onPreviewPressed}
onPress={shouldDisableOnPress ? undefined : props.onPreviewPressed}
Copy link
Contributor Author

@bernhardoj bernhardoj Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to manually disable it by passing an undefined onPress because if we use disabled props, onLongPress will also not work and therefore long pressing an IOU preview (on a mobile screen) won't show a context menu.

onPressIn={() => DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
onPressOut={() => ControlSelection.unblock()}
onLongPress={showContextMenu}
accessibilityLabel={props.isBillSplit ? props.translate('iou.split') : props.translate('iou.cash')}
accessibilityHint={CurrencyUtils.convertToDisplayString(requestAmount, requestCurrency)}
style={[styles.moneyRequestPreviewBox, ...props.containerStyles]}
style={[styles.moneyRequestPreviewBox, ...props.containerStyles, shouldDisableOnPress && styles.cursorDefault]}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me know if we should use default or not-allowed cursor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think default, since that's what we do for our other skeleton UI cc @mananjadhav

>
{childContainer}
</PressableWithFeedback>
Expand Down
Loading