Skip to content

Commit

Permalink
migrated HeaderWithCloseButton to PressableWithoutFeedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Jun 2, 2023
1 parent e77f0a0 commit c417792
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/components/HeaderWithCloseButton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {View, Keyboard, Pressable} from 'react-native';
import {View, Keyboard} from 'react-native';
import styles from '../styles/styles';
import Header from './Header';
import Navigation from '../libs/Navigation/Navigation';
Expand All @@ -18,6 +18,7 @@ import withKeyboardState, {keyboardStatePropTypes} from './withKeyboardState';
import AvatarWithDisplayName from './AvatarWithDisplayName';
import iouReportPropTypes from '../pages/iouReportPropTypes';
import participantPropTypes from './participantPropTypes';
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';

const propTypes = {
/** Title of the Header */
Expand Down Expand Up @@ -153,17 +154,19 @@ class HeaderWithCloseButton extends Component {
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.flexGrow1, styles.justifyContentBetween, styles.overflowHidden]}>
{this.props.shouldShowBackButton && (
<Tooltip text={this.props.translate('common.back')}>
<Pressable
<PressableWithoutFeedback
onPress={() => {
if (this.props.isKeyboardShown) {
Keyboard.dismiss();
}
this.props.onBackButtonPress();
}}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={this.props.translate('common.back')}
>
<Icon src={Expensicons.BackArrow} />
</Pressable>
</PressableWithoutFeedback>
</Tooltip>
)}
{this.props.shouldShowAvatarWithDisplay && (
Expand All @@ -182,33 +185,35 @@ class HeaderWithCloseButton extends Component {
<View style={[styles.reportOptions, styles.flexRow, styles.pr5]}>
{this.props.shouldShowDownloadButton && (
<Tooltip text={this.props.translate('common.download')}>
<Pressable
<PressableWithoutFeedback
onPress={(e) => {
// Blur the pressable in case this button triggers a Growl notification
// We do not want to overlap Growl with the Tooltip (#15271)
e.currentTarget.blur();
this.triggerButtonCompleteAndDownload();
}}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={this.props.translate('common.download')}
>
<Icon
src={Expensicons.Download}
fill={StyleUtils.getIconFillColor(getButtonState(false, false, this.props.isDelayButtonStateComplete))}
/>
</Pressable>
</PressableWithoutFeedback>
</Tooltip>
)}

{this.props.shouldShowGetAssistanceButton && (
<Tooltip text={this.props.translate('getAssistancePage.questionMarkButtonTooltip')}>
<Pressable
<PressableWithoutFeedback
onPress={() => Navigation.navigate(ROUTES.getGetAssistanceRoute(this.props.guidesCallTaskID))}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={this.props.translate('getAssistancePage.questionMarkButtonTooltip')}
>
<Icon src={Expensicons.QuestionMark} />
</Pressable>
</PressableWithoutFeedback>
</Tooltip>
)}

Expand All @@ -222,14 +227,14 @@ class HeaderWithCloseButton extends Component {

{this.props.shouldShowCloseButton && (
<Tooltip text={this.props.translate('common.close')}>
<Pressable
<PressableWithoutFeedback
onPress={this.props.onCloseButtonPress}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={this.props.translate('common.close')}
>
<Icon src={Expensicons.Close} />
</Pressable>
</PressableWithoutFeedback>
</Tooltip>
)}
</View>
Expand Down

0 comments on commit c417792

Please sign in to comment.