From b7b559a16ae678fda324d1000e82fd1ee529c20b Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Thu, 3 Oct 2024 10:29:48 +0200 Subject: [PATCH] add receive qr code --- src/ReceiveModal.tsx | 64 +++++++++++++++++++++++++++++ src/components/steps/HomeScreen.tsx | 11 +++-- 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 src/ReceiveModal.tsx diff --git a/src/ReceiveModal.tsx b/src/ReceiveModal.tsx new file mode 100644 index 0000000..b4a7741 --- /dev/null +++ b/src/ReceiveModal.tsx @@ -0,0 +1,64 @@ +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"; + +type ReceiveModalProps = { + address: string; + isVisible: boolean; + onChangeFunc: () => void; +}; + +const ReceiveModal: FC = props => { + const {address, isVisible, onChangeFunc} = props; + + return ( + + + + + + + )}; + +const modalStyle = StyleSheet.create({ + modalContainer: { + justifyContent: 'flex-end', + margin: 0, + }, + container: { + height: 350, + padding: 40, + alignItems: 'center', + borderTopLeftRadius: 10, + borderTopRightRadius: 10, + borderColor: 'rgba(0, 0, 0, 0.1)', + backgroundColor: 'white' + }, + header: { + paddingTop: '7%', + fontSize: 22, + fontFamily: 'Inconsolata Regular' + }, + prompt: { + paddingTop: '10%', + fontSize: 16, + fontFamily: 'Inconsolata Regular' + }, + iconContainer: { + width: 80, + height: 80, + alignItems: 'center', + justifyContent: 'center', + borderColor: '#0e4e0b', + borderWidth: 3, + borderRadius: 80, + marginTop: '7%', + }, + icon: { + color: '#0e4e0b' + } +}); + +export default ReceiveModal; \ No newline at end of file diff --git a/src/components/steps/HomeScreen.tsx b/src/components/steps/HomeScreen.tsx index 59404ac..c899d89 100644 --- a/src/components/steps/HomeScreen.tsx +++ b/src/components/steps/HomeScreen.tsx @@ -6,11 +6,11 @@ import { bytesToHex, hexToBytes } from "@noble/hashes/utils"; import { bech32 } from "bech32"; import { ripemd160 } from "@noble/hashes/ripemd160"; import { sha256 } from "@noble/hashes/sha256"; +import ReceiveModal from "../../ReceiveModal"; enum HomeSteps { Home, - ScanCode, - ShowAddress, + ScanCode } type HomeScreenProps = { @@ -22,6 +22,7 @@ type HomeScreenProps = { const HomeScreen: FC = props => { const {walletKey, onPressFunc, onCancelFunc} = props; const [step, setStep] = useState(HomeSteps.Home); + const [receiveVisible, setReceiveVisible] = useState(false) const cameraDevice = useCameraDevice('back'); const {hasPermission, requestPermission} = useCameraPermission(); const codeScanner = useCodeScanner({ @@ -69,15 +70,13 @@ const HomeScreen: FC = props => { if (step == HomeSteps.Home) { return - {walletAddress()} - + + {setReceiveVisible(false)} } /> } else if (step == HomeSteps.ScanCode) { return - } else { - return } };