Skip to content

Commit

Permalink
migrate ReportActionCompose to PressableWithFeedback
Browse files Browse the repository at this point in the history
  • Loading branch information
robertKozik committed May 25, 2023
1 parent c53c89b commit 2222337
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View, TouchableOpacity, InteractionManager, LayoutAnimation, NativeModules, findNodeHandle} from 'react-native';
import {View, InteractionManager, LayoutAnimation, NativeModules, findNodeHandle} from 'react-native';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -54,6 +54,7 @@ import * as Welcome from '../../../libs/actions/Welcome';
import Permissions from '../../../libs/Permissions';
import * as TaskUtils from '../../../libs/actions/Task';
import * as Browser from '../../../libs/Browser';
import PressableWithFeedback from '../../../components/Pressable/PressableWithFeedback';

const propTypes = {
/** Beta features list */
Expand Down Expand Up @@ -962,7 +963,7 @@ class ReportActionCompose extends React.Component {
>
{this.props.isComposerFullSize && (
<Tooltip text={this.props.translate('reportActionCompose.collapse')}>
<TouchableOpacity
<PressableWithFeedback
onPress={(e) => {
e.preventDefault();
this.setShouldShowSuggestionMenuToFalse();
Expand All @@ -972,14 +973,16 @@ class ReportActionCompose extends React.Component {
onMouseDown={(e) => e.preventDefault()}
style={styles.composerSizeButton}
disabled={isBlockedFromConcierge || this.props.disabled}
accessibilityRole="button"
accessibilityLabel={this.props.translate('reportActionCompose.collapse')}
>
<Icon src={Expensicons.Collapse} />
</TouchableOpacity>
</PressableWithFeedback>
</Tooltip>
)}
{!this.props.isComposerFullSize && isFullComposerAvailable && (
<Tooltip text={this.props.translate('reportActionCompose.expand')}>
<TouchableOpacity
<PressableWithFeedback
onPress={(e) => {
e.preventDefault();
this.setShouldShowSuggestionMenuToFalse();
Expand All @@ -989,13 +992,15 @@ class ReportActionCompose extends React.Component {
onMouseDown={(e) => e.preventDefault()}
style={styles.composerSizeButton}
disabled={isBlockedFromConcierge || this.props.disabled}
accessibilityRole="button"
accessibilityLabel={this.props.translate('reportActionCompose.expand')}
>
<Icon src={Expensicons.Expand} />
</TouchableOpacity>
</PressableWithFeedback>
</Tooltip>
)}
<Tooltip text={this.props.translate('reportActionCompose.addAction')}>
<TouchableOpacity
<PressableWithFeedback
ref={(el) => (this.actionButton = el)}
onPress={(e) => {
e.preventDefault();
Expand All @@ -1006,9 +1011,11 @@ class ReportActionCompose extends React.Component {
}}
style={styles.composerSizeButton}
disabled={isBlockedFromConcierge || this.props.disabled}
accessibilityRole="button"
accessibilityLabel={this.props.translate('reportActionCompose.addAction')}
>
<Icon src={Expensicons.Plus} />
</TouchableOpacity>
</PressableWithFeedback>
</Tooltip>
</View>
<PopoverMenu
Expand Down Expand Up @@ -1125,22 +1132,18 @@ class ReportActionCompose extends React.Component {
onMouseDown={(e) => e.preventDefault()}
>
<Tooltip text={this.props.translate('common.send')}>
<TouchableOpacity
<PressableWithFeedback
style={[styles.chatItemSubmitButton, this.state.isCommentEmpty || hasExceededMaxCommentLength ? undefined : styles.buttonSuccess]}
onPress={this.submitForm}
disabled={this.state.isCommentEmpty || isBlockedFromConcierge || this.props.disabled || hasExceededMaxCommentLength}
hitSlop={{
top: 3,
right: 3,
bottom: 3,
left: 3,
}}
accessibilityRole="button"
accessibilityLabel={this.props.translate('common.send')}
>
<Icon
src={Expensicons.Send}
fill={this.state.isCommentEmpty || hasExceededMaxCommentLength ? themeColors.icon : themeColors.textLight}
/>
</TouchableOpacity>
</PressableWithFeedback>
</Tooltip>
</View>
</View>
Expand Down

0 comments on commit 2222337

Please sign in to comment.