From 035ed51ec12f46a2254f7e1541649a0e96a52380 Mon Sep 17 00:00:00 2001 From: myxmaster Date: Sun, 12 Jan 2025 16:40:16 +0100 Subject: [PATCH] add iconOnly mode to CopyButton --- components/CopyButton.tsx | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/components/CopyButton.tsx b/components/CopyButton.tsx index bf577e5530..4fceed4db0 100644 --- a/components/CopyButton.tsx +++ b/components/CopyButton.tsx @@ -1,14 +1,18 @@ import * as React from 'react'; -import { Platform } from 'react-native'; +import { Platform, TouchableOpacity } from 'react-native'; +import { Icon } from 'react-native-elements'; import Clipboard from '@react-native-clipboard/clipboard'; import Button from './../components/Button'; import { localeString } from './../utils/LocaleUtils'; +import { themeColor } from './../utils/ThemeUtils'; interface CopyButtonProps { title?: string; copyValue: string; icon?: any; noUppercase?: boolean; + iconOnly?: boolean; + copyIconContainerStyle?: any; } interface CopyButtonState { @@ -52,12 +56,31 @@ export default class CopyButton extends React.Component< render() { const { copied } = this.state; - const { title, icon, noUppercase } = this.props; + const { title, icon, noUppercase, iconOnly, copyIconContainerStyle } = + this.props; const buttonTitle = copied ? localeString('components.CopyButton.copied') : title || localeString('components.CopyButton.copy'); + if (iconOnly) { + return ( + this.copyToClipboard()} + > + + + ); + } + return (