import { useNavigation, useRoute } from '@react-navigation/native'; import React, { useCallback, useContext, useEffect, useState } from 'react'; import { ActivityIndicator, BackHandler, I18nManager, ScrollView, StyleSheet, Text, View } from 'react-native'; import { BlueStorageContext } from '../../blue_modules/storage-context'; import Button from '../../components/Button'; import SafeArea from '../../components/SafeArea'; import { useTheme } from '../../components/themes'; import usePrivacy from '../../hooks/usePrivacy'; import loc from '../../loc'; const PleaseBackup: React.FC = () => { const { wallets } = useContext(BlueStorageContext); const [isLoading, setIsLoading] = useState(true); const { walletID } = useRoute().params as { walletID: string }; const wallet = wallets.find(w => w.getID() === walletID); const navigation = useNavigation(); const { colors } = useTheme(); const { enableBlur, disableBlur } = usePrivacy(); const stylesHook = StyleSheet.create({ flex: { backgroundColor: colors.elevated, }, word: { backgroundColor: colors.inputBackgroundColor, }, wortText: { color: colors.labelText, }, pleaseText: { color: colors.foregroundColor, }, }); const handleBackButton = useCallback(() => { // @ts-ignore: Ignore navigation.getParent()?.pop(); return true; }, [navigation]); useEffect(() => { enableBlur(); setIsLoading(false); BackHandler.addEventListener('hardwareBackPress', handleBackButton); return () => { disableBlur(); BackHandler.removeEventListener('hardwareBackPress', handleBackButton); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const renderSecret = () => { const component: JSX.Element[] = []; const entries = wallet?.getSecret().split(/\s/).entries(); if (entries) { for (const [index, secret] of entries) { if (secret) { const text = `${index + 1}. ${secret} `; component.push( {text} , ); } } } return component; }; return ( {isLoading ? ( ) : ( {loc.pleasebackup.text} {renderSecret()}