import { NativeStackScreenProps } from '@react-navigation/native-stack' import * as React from 'react' import { useTranslation } from 'react-i18next' import { ScrollView, StyleSheet, Text, View } from 'react-native' import { connect } from 'react-redux' import AppAnalytics from 'src/analytics/AppAnalytics' import { OnboardingEvents } from 'src/analytics/Events' import BackupPhraseContainer, { BackupPhraseContainerMode, BackupPhraseType, } from 'src/backup/BackupPhraseContainer' import { useAccountKey } from 'src/backup/utils' import Button from 'src/components/Button' import TextButton from 'src/components/TextButton' import Logo from 'src/images/Logo' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { StackParamList } from 'src/navigator/types' import { RootState } from 'src/redux/reducers' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { Spacing } from 'src/styles/styles' interface StateProps { backupCompleted: boolean } type NavigationProps = NativeStackScreenProps type Props = StateProps & NavigationProps const mapStateToProps = (state: RootState): StateProps => { return { backupCompleted: state.account.backupCompleted, } } /** * Component displayed to the user when entering Recovery Phrase flow from the settings menu or a * notification. Displays content to the user depending on whether they have set up their account * key backup already. */ class BackupIntroduction extends React.Component { onPressBackup = () => { AppAnalytics.track(OnboardingEvents.backup_start) navigate(Screens.AccountKeyEducation) } render() { const { backupCompleted } = this.props return ( {backupCompleted ? ( ) : ( )} ) } } interface AccountKeyStartProps { onPrimaryPress: () => void } /** * Component displayed to the user when entering Recovery Phrase flow prior to a successful completion. * Introduces the user to the Recovery Phrase and invites them to set it up */ function AccountKeyIntro({ onPrimaryPress }: AccountKeyStartProps) { const { t } = useTranslation() return ( {t('introBackUpPhrase')} {t('introCompleteQuiz')}