OPS: Lint

This commit is contained in:
Marcos Rodriguez Velez 2024-03-27 00:53:06 -04:00
parent 137672682e
commit c3988f29fa
No known key found for this signature in database
GPG Key ID: 6030B2F48CCE86D7
3 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,5 @@
import Clipboard from '@react-native-clipboard/clipboard';
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, forwardRef } from 'react';
import { View, TouchableOpacity, Animated, StyleSheet } from 'react-native';
import loc from '../loc';
@ -17,7 +17,7 @@ const styleCopyTextToClipboard = StyleSheet.create({
},
});
export const CopyTextToClipboard: React.FC<CopyTextToClipboardProps> = ({ text, truncated }) => {
const CopyTextToClipboard = forwardRef<TouchableOpacity, CopyTextToClipboardProps>(({ text, truncated }, ref) => {
const [hasTappedText, setHasTappedText] = useState(false);
const [address, setAddress] = useState(text);
@ -31,7 +31,7 @@ export const CopyTextToClipboard: React.FC<CopyTextToClipboardProps> = ({ text,
const copyToClipboard = () => {
setHasTappedText(true);
Clipboard.setString(text);
setAddress(loc.wallets.xpub_copiedToClipboard); // Replace with your localization logic if needed
setAddress(loc.wallets.xpub_copiedToClipboard); // Adjust according to your localization logic
setTimeout(() => {
setHasTappedText(false);
setAddress(text);
@ -40,7 +40,13 @@ export const CopyTextToClipboard: React.FC<CopyTextToClipboardProps> = ({ text,
return (
<View style={styles.container}>
<TouchableOpacity accessibilityRole="button" onPress={copyToClipboard} disabled={hasTappedText} testID="CopyTextToClipboard">
<TouchableOpacity
ref={ref}
accessibilityRole="button"
onPress={copyToClipboard}
disabled={hasTappedText}
testID="CopyTextToClipboard"
>
<Animated.Text
style={styleCopyTextToClipboard.address}
{...(truncated ? { numberOfLines: 1, ellipsizeMode: 'middle' } : { numberOfLines: 0 })}
@ -51,7 +57,7 @@ export const CopyTextToClipboard: React.FC<CopyTextToClipboardProps> = ({ text,
</TouchableOpacity>
</View>
);
};
});
export default CopyTextToClipboard;

View File

@ -2,7 +2,7 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useNavigation, useRoute } from '@react-navigation/native';
import { View, StyleSheet, ScrollView, BackHandler } from 'react-native';
import { CopyTextToClipboard, BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import { BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
@ -11,6 +11,7 @@ import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import SafeArea from '../../components/SafeArea';
import usePrivacy from '../../hooks/usePrivacy';
import CopyTextToClipboard from '../../components/CopyTextToClipboard';
const PleaseBackupLNDHub = () => {
const { wallets } = useContext(BlueStorageContext);

View File

@ -2,7 +2,7 @@ import React, { useCallback, useContext, useEffect } from 'react';
import { useNavigation, useRoute } from '@react-navigation/native';
import { View, useWindowDimensions, StyleSheet, BackHandler, ScrollView } from 'react-native';
import QRCode from 'react-native-qrcode-svg';
import { CopyTextToClipboard, BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import { BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
@ -10,6 +10,7 @@ import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import SafeArea from '../../components/SafeArea';
import usePrivacy from '../../hooks/usePrivacy';
import CopyTextToClipboard from '../../components/CopyTextToClipboard';
const PleaseBackupLdk = () => {
const { wallets } = useContext(BlueStorageContext);