Skip to content

Commit 47f2994

Browse files
authored
Merge pull request #33933 from pasyukevich/feature/migrate-CommunicationsLink
[TS migration] Migrate 'CommunicationsLink.js' component to TypeScript
2 parents a9854fa + 8d17cdc commit 47f2994

File tree

2 files changed

+42
-51
lines changed

2 files changed

+42
-51
lines changed

src/components/CommunicationsLink.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/components/CommunicationsLink.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react';
2+
import type {StyleProp, ViewStyle} from 'react-native';
3+
import {View} from 'react-native';
4+
import useLocalize from '@hooks/useLocalize';
5+
import useThemeStyles from '@hooks/useThemeStyles';
6+
import Clipboard from '@libs/Clipboard';
7+
import type ChildrenProps from '@src/types/utils/ChildrenProps';
8+
import ContextMenuItem from './ContextMenuItem';
9+
import * as Expensicons from './Icon/Expensicons';
10+
11+
type CommunicationsLinkProps = ChildrenProps & {
12+
/** Styles to be assigned to Container */
13+
containerStyles?: StyleProp<ViewStyle>;
14+
15+
/** Value to be copied or passed via tap. */
16+
value: string;
17+
};
18+
19+
function CommunicationsLink({value, containerStyles, children}: CommunicationsLinkProps) {
20+
const styles = useThemeStyles();
21+
const {translate} = useLocalize();
22+
23+
return (
24+
<View style={[styles.flexRow, styles.pRelative, containerStyles]}>
25+
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100, styles.communicationsLinkHeight]}>
26+
<View style={styles.flexShrink1}>{children}</View>
27+
<ContextMenuItem
28+
icon={Expensicons.Copy}
29+
text={translate('reportActionContextMenu.copyToClipboard')}
30+
successIcon={Expensicons.Checkmark}
31+
successText={translate('reportActionContextMenu.copied')}
32+
isMini
33+
onPress={() => Clipboard.setString(value)}
34+
/>
35+
</View>
36+
</View>
37+
);
38+
}
39+
40+
CommunicationsLink.displayName = 'CommunicationsLink';
41+
42+
export default CommunicationsLink;

0 commit comments

Comments
 (0)