diff --git a/package-lock.json b/package-lock.json index c189423..ec16f04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@noble/hashes": "^1.5.0", "@react-native-async-storage/async-storage": "^2.0.0", + "@react-native-clipboard/clipboard": "^1.14.2", "@scure/bip39": "^1.4.0", "bech32": "^2.0.0", "react": "18.3.1", @@ -3176,6 +3177,29 @@ "react-native": "^0.0.0-0 || >=0.65 <1.0" } }, + "node_modules/@react-native-clipboard/clipboard": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/@react-native-clipboard/clipboard/-/clipboard-1.14.2.tgz", + "integrity": "sha512-Mb58f3neB6sM9oOtKYVGLvN8KVByea67OA9ekJ0c9FwdH24INu8RJoA7/fq+PRk+7oxbeamAcEoQPRv0uwbbMw==", + "license": "MIT", + "workspaces": [ + "example" + ], + "peerDependencies": { + "react": ">= 16.9.0", + "react-native": ">= 0.61.5", + "react-native-macos": ">= 0.61.0", + "react-native-windows": ">= 0.61.0" + }, + "peerDependenciesMeta": { + "react-native-macos": { + "optional": true + }, + "react-native-windows": { + "optional": true + } + } + }, "node_modules/@react-native-community/cli": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/@react-native-community/cli/-/cli-14.1.0.tgz", diff --git a/package.json b/package.json index 3ea480d..30b8f30 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "@noble/hashes": "^1.5.0", "@react-native-async-storage/async-storage": "^2.0.0", + "@react-native-clipboard/clipboard": "^1.14.2", "@scure/bip39": "^1.4.0", "bech32": "^2.0.0", "react": "18.3.1", diff --git a/src/ReceiveModal.tsx b/src/ReceiveModal.tsx index 7031a86..e6be6c2 100644 --- a/src/ReceiveModal.tsx +++ b/src/ReceiveModal.tsx @@ -1,23 +1,33 @@ import React, {FC} from "react"; import {StyleSheet, View } from "react-native"; import Modal from "react-native-modal/dist/modal"; -import Button from "./components/Button"; import QRCode from "react-qr-code"; +import Styles from "./Styles"; +import IconButton from "./components/IconButton"; type ReceiveModalProps = { address: string; isVisible: boolean; onChangeFunc: () => void; + onCancelFunc: () => void; }; const ReceiveModal: FC = props => { - const {address, isVisible, onChangeFunc} = props; + const {address, isVisible, onChangeFunc, onCancelFunc} = props; + + const addressLabel = () => { + return address.substring(0, 5) + "\u2026" + address.substring(address.length - 5); + } return ( - + - - + + + + + + )}; @@ -28,13 +38,13 @@ const modalStyle = StyleSheet.create({ margin: 0, }, container: { - height: 350, + height: 420, padding: 40, alignItems: 'center', borderTopLeftRadius: 10, borderTopRightRadius: 10, borderColor: 'rgba(0, 0, 0, 0.1)', - backgroundColor: 'white' + backgroundColor: '#320430' }, header: { paddingTop: '7%', diff --git a/src/components/steps/HomeScreen.tsx b/src/components/steps/HomeScreen.tsx index d0d1e52..7162f51 100644 --- a/src/components/steps/HomeScreen.tsx +++ b/src/components/steps/HomeScreen.tsx @@ -1,6 +1,5 @@ import {FC, useEffect, useRef, useState } from "react"; import { StyleSheet, Text, TouchableOpacity, View } from "react-native"; -import Button from "../Button"; import { Camera, useCameraDevice, useCameraPermission, useCodeScanner } from "react-native-vision-camera"; import { hexToBytes } from "@noble/hashes/utils"; import { bech32 } from "bech32"; @@ -12,6 +11,7 @@ import Styles from "../../Styles"; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import SubMenuModal from "../SubMenuModal"; import IconButton from "../IconButton"; +import Clipboard from "@react-native-clipboard/clipboard"; enum HomeSteps { Home, @@ -90,6 +90,11 @@ const HomeScreen: FC = props => { setMenuVisible(true); } + const copyAddressAndClose = () => { + Clipboard.setString(walletAddress()); + setReceiveVisible(false); + } + useEffect(() => { if (!hasPermission) { if (!requestPermission()) { @@ -114,7 +119,7 @@ const HomeScreen: FC = props => { setStep(HomeSteps.ScanCode)}/> - {setReceiveVisible(false)} } /> + setReceiveVisible(false)}/> } {step == HomeSteps.ScanCode &&