import { useSnapshot } from 'valtio'; import { ScrollView } from 'react-native'; import { Avatar, Button, FlexView, Icon, Image, Text, UiUtil, useCustomDimensions } from '@reown/appkit-ui-react-native'; import { NumberUtil } from '@reown/appkit-common-react-native'; import { ConnectionsController, RouterController, SendController } from '@reown/appkit-core-react-native'; import { PreviewSendPill } from './components/preview-send-pill'; import styles from './styles'; import { PreviewSendDetails } from './components/preview-send-details'; export function WalletSendPreviewView() { const { padding } = useCustomDimensions(); const { activeNetwork } = useSnapshot(ConnectionsController.state); const { token, receiverAddress, receiverProfileName, receiverProfileImageUrl, loading } = useSnapshot(SendController.state); const getSendValue = () => { if (SendController.state.token?.price && SendController.state.sendTokenAmount) { const price = SendController.state.token.price; const totalValue = price * SendController.state.sendTokenAmount; return totalValue.toFixed(2); } return null; }; const getTokenAmount = () => { const value = SendController.state.sendTokenAmount ? NumberUtil.roundNumber(SendController.state.sendTokenAmount, 6, 5) : 'unknown'; return `${value} ${SendController.state.token?.symbol}`; }; const formattedAddress = receiverProfileName ? UiUtil.getTruncateString({ string: receiverProfileName, charsStart: 20, charsEnd: 0, truncate: 'end' }) : UiUtil.getTruncateString({ string: receiverAddress || '', charsStart: 4, charsEnd: 4, truncate: 'middle' }); const onSend = () => { SendController.sendToken(); }; const onCancel = () => { RouterController.goBack(); SendController.setLoading(false); }; return ( Send ${getSendValue()} {token?.iconUrl ? ( ) : ( )} To Review transaction carefully ); }