Skip to content

Commit ef73fde

Browse files
authored
Merge pull request #88920 from daledah/follow-up/86646
fix: right label and badge style in menu item
2 parents 0e6c06c + 7d26b50 commit ef73fde

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/components/MenuItem.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ type MenuItemBaseProps = ForwardedFSClassProps &
253253
subtitle?: string | number;
254254

255255
/** Any additional styles to apply to the subtitle */
256-
subtitleStyle?: StyleProp<TextStyle>;
256+
subtitleStyle?: StyleProp<ViewStyle>;
257257

258258
/** Should the title show with normal font weight (not bold) */
259259
shouldShowBasicTitle?: boolean;
@@ -1088,7 +1088,11 @@ function MenuItem({
10881088
<Badge
10891089
text={badgeText}
10901090
icon={badgeIcon}
1091-
badgeStyles={[badgeStyle, focused && !isBadgeSuccess && styles.badgeDefaultActive]}
1091+
badgeStyles={[
1092+
badgeStyle,
1093+
focused && !isBadgeSuccess && styles.badgeDefaultActive,
1094+
(!!rightComponent || shouldShowRightIcon) && styles.mr2,
1095+
]}
10921096
success={isBadgeSuccess}
10931097
isStrong={isBadgeStrong}
10941098
isCondensed={isBadgeCondensed}
@@ -1099,8 +1103,8 @@ function MenuItem({
10991103
)}
11001104
{/* Since subtitle can be of type number, we should allow 0 to be shown */}
11011105
{(subtitle === 0 || !!subtitle) && (
1102-
<View style={[styles.justifyContentCenter, styles.mr1]}>
1103-
<Text style={[styles.textLabelSupporting, ...(combinedStyle as TextStyle[]), subtitleStyle]}>{subtitle}</Text>
1106+
<View style={[styles.justifyContentCenter, styles.mr1, subtitleStyle]}>
1107+
<Text style={[styles.textLabelSupporting, ...(combinedStyle as TextStyle[])]}>{subtitle}</Text>
11041108
</View>
11051109
)}
11061110
{(!!rightIconAccountID || !!rightIconReportID) && (
@@ -1139,7 +1143,7 @@ function MenuItem({
11391143
height={variables.iconSizeSmall}
11401144
/>
11411145
)}
1142-
<Text style={styles.rightLabelMenuItem}>{rightLabel}</Text>
1146+
<Text style={[styles.rightLabelMenuItem, (!!rightComponent || shouldShowRightIcon) && styles.mr2]}>{rightLabel}</Text>
11431147
</View>
11441148
)}
11451149
{shouldShowRightIcon && (

src/pages/ReportDetailsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {StackActions} from '@react-navigation/native';
22
import {delegateEmailSelector} from '@selectors/Account';
33
import {validTransactionDraftIDsSelector} from '@selectors/TransactionDraft';
44
import React, {useCallback, useEffect, useMemo} from 'react';
5-
import type {StyleProp, TextStyle} from 'react-native';
5+
import type {StyleProp, ViewStyle} from 'react-native';
66
// eslint-disable-next-line no-restricted-imports
77
import {InteractionManager, View} from 'react-native';
88
import type {OnyxEntry} from 'react-native-onyx';
@@ -149,7 +149,7 @@ type ReportDetailsPageMenuItem = {
149149
brickRoadIndicator?: ValueOf<typeof CONST.BRICK_ROAD_INDICATOR_STATUS>;
150150
subtitle?: number;
151151
shouldShowRightIcon?: boolean;
152-
subtitleStyle?: StyleProp<TextStyle>;
152+
subtitleStyle?: StyleProp<ViewStyle>;
153153
};
154154

155155
type ReportDetailsPageProps = WithReportOrNotFoundProps & PlatformStackScreenProps<ReportDetailsNavigatorParamList, typeof SCREENS.REPORT_DETAILS.ROOT>;

0 commit comments

Comments
 (0)