Skip to content
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
Binary file added Cloudflare_CA.crt
Binary file not shown.
9 changes: 7 additions & 2 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const defaultProps = {
disabled: false,
isSelected: false,
subtitle: undefined,
subtitleTextStyle: {},
iconType: CONST.ICON_TYPE_ICON,
onPress: () => {},
onSecondaryInteraction: undefined,
Expand All @@ -76,6 +75,7 @@ const defaultProps = {
title: '',
numberOfLinesTitle: 1,
shouldGreyOutWhenDisabled: true,
error: '',
shouldRenderAsHTML: false,
};

Expand Down Expand Up @@ -266,6 +266,11 @@ const MenuItem = React.forwardRef((props, ref) => {
{props.description}
</Text>
)}
{props.error && (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright, managed to test this one on my local env. It looks like @aimane-chnaif already tested on all platforms. I will merge this.

I tested but console error is very annoying, happening on every page which uses MenuItem.

Screen.Recording.2023-09-27.at.12.57.23.PM.mov

I raised quick PR to fix that:
#28314

<View style={[styles.mt1]}>
<Text style={[styles.textLabelError]}>{props.error}</Text>
</View>
)}
{Boolean(props.furtherDetails) && (
<View style={[styles.flexRow, styles.mt1, styles.alignItemsCenter]}>
<Icon
Expand Down Expand Up @@ -299,7 +304,7 @@ const MenuItem = React.forwardRef((props, ref) => {
{/* Since subtitle can be of type number, we should allow 0 to be shown */}
{(props.subtitle || props.subtitle === 0) && (
<View style={[styles.justifyContentCenter, styles.mr1]}>
<Text style={[props.subtitleTextStyle || styles.textLabelSupporting, props.style]}>{props.subtitle}</Text>
<Text style={[styles.textLabelSupporting, props.style]}>{props.subtitle}</Text>
</View>
)}
{!_.isEmpty(props.floatRightAvatars) && (
Expand Down
9 changes: 3 additions & 6 deletions src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
shouldShowRightIcon={canEdit}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.AMOUNT))}
brickRoadIndicator={hasErrors && transactionAmount === 0 ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
subtitle={hasErrors && transactionAmount === 0 ? translate('common.error.enterAmount') : ''}
subtitleTextStyle={styles.textLabelError}
error={hasErrors && transactionAmount === 0 ? translate('common.error.enterAmount') : ''}
/>
</OfflineWithFeedback>
<OfflineWithFeedback pendingAction={lodashGet(transaction, 'pendingFields.comment') || lodashGet(transaction, 'pendingAction')}>
Expand All @@ -152,8 +151,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.DATE))}
brickRoadIndicator={hasErrors && transactionDate === '' ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
subtitle={hasErrors && transactionDate === '' ? translate('common.error.enterDate') : ''}
subtitleTextStyle={styles.textLabelError}
error={hasErrors && transactionDate === '' ? translate('common.error.enterDate') : ''}
/>
</OfflineWithFeedback>
<OfflineWithFeedback pendingAction={lodashGet(transaction, 'pendingFields.merchant') || lodashGet(transaction, 'pendingAction')}>
Expand All @@ -165,8 +163,7 @@ function MoneyRequestView({report, parentReport, shouldShowHorizontalRule, trans
titleStyle={styles.flex1}
onPress={() => Navigation.navigate(ROUTES.getEditRequestRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.MERCHANT))}
brickRoadIndicator={hasErrors && isEmptyMerchant ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
subtitle={hasErrors && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}
subtitleTextStyle={styles.textLabelError}
error={hasErrors && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}
/>
</OfflineWithFeedback>
{shouldShowHorizontalRule && <View style={styles.reportHorizontalRule} />}
Expand Down
6 changes: 3 additions & 3 deletions src/components/menuItemPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ const propTypes = {
/** A right-aligned subtitle for this menu option */
subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),

/** Style for the subtitle */
subtitleTextStyle: stylePropTypes,

/** Flag to choose between avatar image or an icon */
iconType: PropTypes.oneOf([CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_ICON, CONST.ICON_TYPE_WORKSPACE]),

Expand Down Expand Up @@ -145,6 +142,9 @@ const propTypes = {
/** Should we grey out the menu item when it is disabled? */
shouldGreyOutWhenDisabled: PropTypes.bool,

/** Error to display below the title */
error: PropTypes.string,

/** Should render the content in HTML format */
shouldRenderAsHTML: PropTypes.bool,
};
Expand Down