import { NativeStackScreenProps } from '@react-navigation/native-stack' import React, { useState } from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text, View } from 'react-native' import { getFontScaleSync } from 'react-native-device-info' import { SafeAreaView } from 'react-native-safe-area-context' import { isAddressFormat } from 'src/account/utils' import AppAnalytics from 'src/analytics/AppAnalytics' import { SendEvents } from 'src/analytics/Events' import { SendOrigin } from 'src/analytics/types' import BackButton from 'src/components/BackButton' import Button, { BtnSizes } from 'src/components/Button' import InLineNotification, { NotificationVariant } from 'src/components/InLineNotification' import InviteOptionsModal from 'src/components/InviteOptionsModal' import KeyboardAwareScrollView from 'src/components/KeyboardAwareScrollView' import CustomHeader from 'src/components/header/CustomHeader' import CircledIcon from 'src/icons/CircledIcon' import { importContacts } from 'src/identity/actions' import { getAddressFromPhoneNumber } from 'src/identity/contactMapping' import { AddressValidationType } from 'src/identity/reducer' import { getAddressValidationType } from 'src/identity/secureSend' import { e164NumberToAddressSelector, secureSendPhoneNumberMappingSelector, } from 'src/identity/selectors' import { RecipientVerificationStatus } from 'src/identity/types' import { noHeader } from 'src/navigator/Headers' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import RecipientPicker from 'src/recipients/RecipientPickerV2' import { Recipient, RecipientType, recipientHasNumber } from 'src/recipients/recipient' import { useDispatch, useSelector } from 'src/redux/hooks' import InviteRewardsCard from 'src/send/InviteRewardsCard' import PasteAddressButton from 'src/send/PasteAddressButton' import SelectRecipientButtons from 'src/send/SelectRecipientButtons' import { SendSelectRecipientSearchInput } from 'src/send/SendSelectRecipientSearchInput' import { useMergedSearchRecipients, useSendRecipients } from 'src/send/hooks' import { inviteRewardsActiveSelector } from 'src/send/selectors' import useFetchRecipientVerificationStatus from 'src/send/useFetchRecipientVerificationStatus' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' import variables from 'src/styles/variables' type Props = NativeStackScreenProps function GetStartedSection() { const { t } = useTranslation() const renderOption = ({ optionNum, title, subtitle, }: { optionNum: string title: string subtitle: string }) => { return ( {optionNum} {title} {subtitle} ) } const options = [ { optionNum: '1', title: t('sendSelectRecipient.getStarted.options.one.title'), subtitle: t('sendSelectRecipient.getStarted.options.one.subtitle'), }, { optionNum: '2', title: t('sendSelectRecipient.getStarted.options.two.title'), subtitle: t('sendSelectRecipient.getStarted.options.two.subtitle'), }, ] return ( {t('sendSelectRecipient.getStarted.subtitle')} {t('sendSelectRecipient.getStarted.title')} {options.map((params) => renderOption(params))} ) } const getStartedStyles = StyleSheet.create({ container: { backgroundColor: colors.backgroundSecondary, padding: Spacing.Thick24, margin: Spacing.Regular16, marginTop: Spacing.Large32, borderRadius: 10, gap: Spacing.Regular16, }, subtitle: { ...typeScale.labelXXSmall, color: colors.contentSecondary, }, title: { ...typeScale.labelMedium, }, optionWrapper: { flexDirection: 'row', }, optionNum: { borderWidth: 1, borderColor: colors.borderSecondary, }, optionNumText: { ...typeScale.labelXSmall, }, optionText: { paddingLeft: Spacing.Smallest8, flex: 1, }, optionTitle: { ...typeScale.labelSmall, paddingBottom: Spacing.Tiny4, }, optionSubtitle: { ...typeScale.bodyXSmall, color: colors.contentSecondary, }, }) function SendOrInviteButton({ recipient, recipientVerificationStatus, onPress, }: { recipient: Recipient | null recipientVerificationStatus: RecipientVerificationStatus onPress: (shouldInviteRecipient: boolean) => void }) { const { t } = useTranslation() const sendOrInviteButtonDisabled = !!recipient && recipientVerificationStatus === RecipientVerificationStatus.UNKNOWN const shouldInviteRecipient = !sendOrInviteButtonDisabled && recipient?.recipientType === RecipientType.PhoneNumber && recipientVerificationStatus === RecipientVerificationStatus.UNVERIFIED return (