Skip to content

Commit

Permalink
Merge pull request #20711 from robertKozik/20602-migrate-PinButton
Browse files Browse the repository at this point in the history
20602 — migrate PinButton to PressableWithoutFeedback
  • Loading branch information
roryabraham authored Jun 16, 2023
2 parents cc9cab1 + aa9d332 commit d3afedb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/PinButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import {Pressable} from 'react-native';
import styles from '../styles/styles';
import themeColors from '../styles/themes/default';
import Icon from './Icon';
Expand All @@ -9,6 +8,7 @@ import reportPropTypes from '../pages/reportPropTypes';
import * as Report from '../libs/actions/Report';
import * as Expensicons from './Icon/Expensicons';
import * as Session from '../libs/actions/Session';
import PressableWithFeedback from './Pressable/PressableWithFeedback';

const propTypes = {
/** Report to pin */
Expand All @@ -23,15 +23,18 @@ const defaultProps = {
function PinButton(props) {
return (
<Tooltip text={props.report.isPinned ? props.translate('common.unPin') : props.translate('common.pin')}>
<Pressable
<PressableWithFeedback
onPress={Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned))}
style={[styles.touchableButtonImage]}
accessibilityState={{checked: props.report.isPinned}}
accessibilityLabel={props.report.isPinned ? props.translate('common.unPin') : props.translate('common.pin')}
accessibilityRole="button"
>
<Icon
src={Expensicons.Pin}
fill={props.report.isPinned ? themeColors.heading : themeColors.icon}
/>
</Pressable>
</PressableWithFeedback>
</Tooltip>
);
}
Expand Down

0 comments on commit d3afedb

Please sign in to comment.