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 styles for MoneyRequestHeader #18467

Merged
merged 4 commits into from
May 5, 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
96 changes: 47 additions & 49 deletions src/components/AvatarWithDisplayName.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,59 +51,57 @@ const AvatarWithDisplayName = (props) => {
const ownerPersonalDetails = OptionsListUtils.getPersonalDetailsForLogins([props.report.ownerEmail], props.personalDetails);
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(ownerPersonalDetails, false);
return (
<View>
<View style={[styles.appContentHeaderTitle]}>
{Boolean(props.report && title) && (
<View
<View style={[styles.appContentHeaderTitle, styles.flex1]}>
{Boolean(props.report && title) && (
<View
style={[
styles.flexRow,
styles.alignItemsCenter,
styles.justifyContentBetween,
]}
>
{isExpenseReport ? (
<SubscriptAvatar
mainAvatar={icons[0]}
secondaryAvatar={icons[1]}
mainTooltip={props.report.ownerEmail}
secondaryTooltip={subtitle}
size={props.size}
/>
) : (
<Avatar
size={props.size}
source={icons[0].source}
type={icons[0].type}
name={icons[0].name}
containerStyles={props.size === CONST.AVATAR_SIZE.SMALL ? styles.emptyAvatarSmall : styles.emptyAvatar}
/>
)}
<View style={[styles.flex1, styles.flexColumn, styles.ml3]}>
<DisplayNames
fullTitle={title}
displayNamesWithTooltips={displayNamesWithTooltips}
tooltipEnabled
numberOfLines={1}
textStyles={[styles.headerText, styles.pre]}
shouldUseFullTitle={isExpenseReport}
/>
{!_.isEmpty(subtitle) && (
<Text
style={[
styles.flexRow,
styles.alignItemsCenter,
styles.justifyContentBetween,
styles.sidebarLinkText,
styles.optionAlternateText,
styles.textLabelSupporting,
styles.pre,
]}
numberOfLines={1}
>
{isExpenseReport ? (
<SubscriptAvatar
mainAvatar={icons[0]}
secondaryAvatar={icons[1]}
mainTooltip={props.report.ownerEmail}
secondaryTooltip={subtitle}
size={props.size}
/>
) : (
<Avatar
size={props.size}
source={icons[0].source}
type={icons[0].type}
name={icons[0].name}
containerStyles={props.size === CONST.AVATAR_SIZE.SMALL ? styles.emptyAvatarSmall : styles.emptyAvatar}
/>
)}
<View style={[styles.flex1, styles.flexColumn]}>
<DisplayNames
fullTitle={title}
displayNamesWithTooltips={displayNamesWithTooltips}
tooltipEnabled
numberOfLines={1}
textStyles={[styles.headerText, styles.pre]}
shouldUseFullTitle={isExpenseReport}
/>
{!_.isEmpty(subtitle) && (
<Text
style={[
styles.sidebarLinkText,
styles.optionAlternateText,
styles.textLabelSupporting,
styles.pre,
]}
numberOfLines={1}
>
{subtitle}
</Text>
)}
</View>
</View>
)}
{subtitle}
</Text>
)}
</View>
</View>
)}
</View>
);
};
Expand Down
33 changes: 14 additions & 19 deletions src/components/HeaderWithCloseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ const propTypes = {
/** Policies, if we're showing the details for a report and need participant details for AvatarWithDisplay */
personalDetails: PropTypes.objectOf(participantPropTypes),

/** Additional styles to render on the container of this component */
// eslint-disable-next-line react/forbid-prop-types
containerStyles: PropTypes.arrayOf(PropTypes.object),

...withLocalizePropTypes,
...withDelayToggleButtonStatePropTypes,
...keyboardStatePropTypes,
Expand Down Expand Up @@ -130,7 +126,6 @@ const defaultProps = {
top: 0,
left: 0,
},
containerStyles: [],
};

class HeaderWithCloseButton extends Component {
Expand All @@ -155,7 +150,7 @@ class HeaderWithCloseButton extends Component {

render() {
return (
<View style={[styles.headerBar, this.props.shouldShowBorderBottom && styles.borderBottom, this.props.shouldShowBackButton && styles.pl2, ...this.props.containerStyles]}>
<View style={[styles.headerBar, this.props.shouldShowBorderBottom && styles.borderBottom, this.props.shouldShowBackButton && styles.pl2]}>
<View style={[
styles.dFlex,
styles.flexRow,
Expand All @@ -166,19 +161,19 @@ class HeaderWithCloseButton extends Component {
]}
>
{this.props.shouldShowBackButton && (
<Tooltip text={this.props.translate('common.back')}>
<Pressable
onPress={() => {
if (this.props.isKeyboardShown) {
Keyboard.dismiss();
}
this.props.onBackButtonPress();
}}
style={[styles.touchableButtonImage]}
>
<Icon src={Expensicons.BackArrow} />
</Pressable>
</Tooltip>
<Tooltip text={this.props.translate('common.back')}>
<Pressable
onPress={() => {
if (this.props.isKeyboardShown) {
Keyboard.dismiss();
}
this.props.onBackButtonPress();
}}
style={[styles.touchableButtonImage]}
>
<Icon src={Expensicons.BackArrow} />
</Pressable>
</Tooltip>
)}
{this.props.shouldShowAvatarWithDisplay && (
<AvatarWithDisplayName
Expand Down
1 change: 0 additions & 1 deletion src/components/MoneyRequestHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const MoneyRequestHeader = (props) => {
report={props.report}
policies={props.policies}
personalDetails={props.personalDetails}
containerStyles={[styles.pt5, styles.pb3, styles.pr1]}
shouldShowCloseButton={false}
shouldShowBackButton={props.isSmallScreenWidth}
onBackButtonPress={() => Navigation.navigate(ROUTES.HOME)}
Expand Down