Skip to content

Commit

Permalink
destructure props, add coment to eslint disable
Browse files Browse the repository at this point in the history
  • Loading branch information
JKobrynski committed Nov 20, 2023
1 parent 9fa22aa commit abf847e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/CopyTextToClipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ type CopyTextToClipboardProps = {
urlToCopy?: string;
};

function CopyTextToClipboard(props: CopyTextToClipboardProps) {
function CopyTextToClipboard({text, textStyles, urlToCopy}: CopyTextToClipboardProps) {
const {translate} = useLocalize();

const copyToClipboard = useCallback(() => {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Clipboard.setString(props.urlToCopy || props.text);
}, [props.text, props.urlToCopy]);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing doesn't achieve the same result in this case
Clipboard.setString(urlToCopy || text);
}, [text, urlToCopy]);

return (
<PressableWithDelayToggle
text={props.text}
text={text}
tooltipText={translate('reportActionContextMenu.copyToClipboard')}
tooltipTextChecked={translate('reportActionContextMenu.copied')}
icon={Expensicons.Copy}
textStyles={props.textStyles}
textStyles={textStyles}
onPress={copyToClipboard}
accessible
accessibilityLabel={translate('reportActionContextMenu.copyEmailToClipboard')}
Expand Down

0 comments on commit abf847e

Please sign in to comment.