BlueWallet/screen/wallets/transactions.js

701 lines
23 KiB
JavaScript
Raw Normal View History

import { useFocusEffect, useRoute } from '@react-navigation/native';
import PropTypes from 'prop-types';
2024-05-18 00:34:39 +02:00
import React, { useCallback, useEffect, useRef, useState } from 'react';
2019-09-19 01:26:28 +02:00
import {
ActivityIndicator,
2020-01-01 04:31:04 +01:00
Alert,
2020-11-17 09:43:38 +01:00
Dimensions,
2024-05-20 11:54:13 +02:00
findNodeHandle,
2020-11-17 09:43:38 +01:00
FlatList,
I18nManager,
InteractionManager,
LayoutAnimation,
2020-09-09 19:51:49 +02:00
PixelRatio,
2020-11-17 09:43:38 +01:00
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
2019-09-19 01:26:28 +02:00
} from 'react-native';
2020-11-17 09:43:38 +01:00
import { Icon } from 'react-native-elements';
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
import BlueClipboard from '../../blue_modules/clipboard';
import { isDesktop } from '../../blue_modules/environment';
import * as fs from '../../blue_modules/fs';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
import WalletGradient from '../../class/wallet-gradient';
import presentAlert from '../../components/Alert';
import { FButton, FContainer } from '../../components/FloatButtons';
2021-09-09 13:00:11 +02:00
import LNNodeBar from '../../components/LNNodeBar';
import navigationStyle from '../../components/navigationStyle';
2023-10-24 03:28:44 +02:00
import { useTheme } from '../../components/themes';
2024-05-20 11:54:13 +02:00
import { TransactionListItem } from '../../components/TransactionListItem';
import TransactionsNavigationHeader, { actionKeys } from '../../components/TransactionsNavigationHeader';
2024-03-24 21:29:58 +01:00
import { presentWalletExportReminder } from '../../helpers/presentWalletExportReminder';
import { scanQrHelper } from '../../helpers/scan-qr';
2024-06-04 03:54:32 +02:00
import { unlockWithBiometrics, useBiometrics } from '../../hooks/useBiometrics';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import loc from '../../loc';
import { Chain } from '../../models/bitcoinUnits';
import ActionSheet from '../ActionSheet';
2024-05-31 19:22:22 +02:00
import { useStorage } from '../../hooks/context/useStorage';
import { WalletTransactionsStatus } from '../../components/Context/StorageProvider';
2020-09-07 19:46:37 +02:00
const buttonFontSize =
PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26) > 22
? 22
: PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26);
2022-12-07 03:43:54 +01:00
const WalletTransactions = ({ navigation }) => {
const {
wallets,
saveToDisk,
setSelectedWalletID,
walletTransactionUpdateStatus,
isElectrumDisabled,
setReloadTransactionsMenuActionFunction,
2024-05-18 00:34:39 +02:00
} = useStorage();
2024-06-04 03:54:32 +02:00
const { isBiometricUseCapableAndEnabled } = useBiometrics();
const [isLoading, setIsLoading] = useState(false);
2021-03-04 14:17:49 +01:00
const { walletID } = useRoute().params;
2024-03-13 22:54:32 +01:00
const { name } = useRoute();
const wallet = wallets.find(w => w.getID() === walletID);
2021-02-04 05:54:24 +01:00
const [itemPriceUnit, setItemPriceUnit] = useState(wallet.getPreferredBalanceUnit());
const [dataSource, setDataSource] = useState(wallet.getTransactions(15));
const [isRefreshing, setIsRefreshing] = useState(false); // a simple flag to know that wallet was being updated once
const [timeElapsed, setTimeElapsed] = useState(0);
const [limit, setLimit] = useState(15);
const [pageSize, setPageSize] = useState(20);
2024-03-24 15:52:10 +01:00
const { setParams, setOptions, navigate } = useExtendedNavigation();
const { colors } = useTheme();
2021-09-09 13:00:11 +02:00
const [lnNodeInfo, setLnNodeInfo] = useState({ canReceive: 0, canSend: 0 });
const walletActionButtonsRef = useRef();
const stylesHook = StyleSheet.create({
listHeaderText: {
color: colors.foregroundColor,
},
list: {
backgroundColor: colors.background,
},
});
/**
* Simple wrapper for `wallet.getTransactions()`, where `wallet` is current wallet.
* Sorts. Provides limiting.
*
* @param lmt {Integer} How many txs return, starting from the earliest. Default: all of them.
* @returns {Array}
*/
const getTransactionsSliced = (lmt = Infinity) => {
let txs = wallet.getTransactions();
for (const tx of txs) {
tx.sort_ts = +new Date(tx.received);
}
txs = txs.sort(function (a, b) {
return b.sort_ts - a.sort_ts;
});
return txs.slice(0, lmt);
};
useEffect(() => {
2020-09-14 12:49:08 +02:00
const interval = setInterval(() => setTimeElapsed(prev => prev + 1), 60000);
return () => {
clearInterval(interval);
};
}, []);
2021-01-28 01:30:42 +01:00
useEffect(() => {
if (walletTransactionUpdateStatus === walletID) {
// wallet is being refreshed, drawing the 'Updating...' header:
setOptions({ headerTitle: loc.transactions.updating });
setIsRefreshing(true);
} else {
setOptions({ headerTitle: '' });
}
if (isRefreshing && walletTransactionUpdateStatus === WalletTransactionsStatus.NONE) {
// if we are here this means that wallet was being updated (`walletTransactionUpdateStatus` was set, and
// `isRefreshing` flag was set) and we displayed "Updating..." message,
// and when it ended `walletTransactionUpdateStatus` became false (flag `isRefreshing` stayed).
// chances are that txs list changed for the wallet, so we need to re-render:
console.log('re-rendering transactions');
setDataSource([...getTransactionsSliced(limit)]);
setIsRefreshing(false);
}
2021-01-28 01:30:42 +01:00
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [walletTransactionUpdateStatus]);
useEffect(() => {
setIsLoading(true);
setLimit(15);
setPageSize(20);
setTimeElapsed(0);
setItemPriceUnit(wallet.getPreferredBalanceUnit());
setIsLoading(false);
setSelectedWalletID(wallet.getID());
setDataSource([...getTransactionsSliced(limit)]);
setOptions({
headerStyle: {
backgroundColor: WalletGradient.headerColorFor(wallet.type),
borderBottomWidth: 0,
elevation: 0,
// shadowRadius: 0,
shadowOffset: { height: 0, width: 0 },
},
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [wallet]);
useEffect(() => {
const newWallet = wallets.find(w => w.getID() === walletID);
if (newWallet) {
setParams({ walletID, isLoading: false });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [walletID]);
// refresh transactions if it never hasn't been done. It could be a fresh imported wallet
useEffect(() => {
2021-04-21 12:29:34 +02:00
if (wallet.getLastTxFetch() === 0) {
refreshTransactions();
}
2021-09-09 13:00:11 +02:00
refreshLnNodeInfo();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// if description of transaction has been changed we want to show new one
useFocusEffect(
useCallback(() => {
setTimeElapsed(prev => prev + 1);
}, []),
);
const isLightning = () => {
const w = wallet;
2019-12-25 21:53:53 +01:00
if (w && w.chain === Chain.OFFCHAIN) {
return true;
}
return false;
};
2021-09-09 13:00:11 +02:00
const refreshLnNodeInfo = () => {
if (wallet.type === LightningLdkWallet.type) {
setLnNodeInfo({ canReceive: wallet.getReceivableBalance(), canSend: wallet.getBalance() });
}
};
/**
* Forcefully fetches TXs and balance for wallet
*/
const refreshTransactions = async () => {
2021-08-24 06:33:32 +02:00
if (isElectrumDisabled) return setIsLoading(false);
if (isLoading) return;
setIsLoading(true);
let noErr = true;
let smthChanged = false;
try {
2021-09-09 13:00:11 +02:00
refreshLnNodeInfo();
// await BlueElectrum.ping();
await BlueElectrum.waitTillConnected();
if (wallet.allowBIP47() && wallet.isBIP47Enabled()) {
2023-03-15 21:42:25 +01:00
const pcStart = +new Date();
await wallet.fetchBIP47SenderPaymentCodes();
const pcEnd = +new Date();
console.log(wallet.getLabel(), 'fetch payment codes took', (pcEnd - pcStart) / 1000, 'sec');
}
const balanceStart = +new Date();
const oldBalance = wallet.getBalance();
await wallet.fetchBalance();
if (oldBalance !== wallet.getBalance()) smthChanged = true;
const balanceEnd = +new Date();
console.log(wallet.getLabel(), 'fetch balance took', (balanceEnd - balanceStart) / 1000, 'sec');
const start = +new Date();
const oldTxLen = wallet.getTransactions().length;
let immatureTxsConfs = ''; // a silly way to keep track if anything changed in immature transactions
for (const tx of wallet.getTransactions()) {
if (tx.confirmations < 7) immatureTxsConfs += tx.txid + ':' + tx.confirmations + ';';
}
await wallet.fetchTransactions();
if (wallet.fetchPendingTransactions) {
await wallet.fetchPendingTransactions();
}
if (wallet.fetchUserInvoices) {
await wallet.fetchUserInvoices();
}
if (oldTxLen !== wallet.getTransactions().length) smthChanged = true;
let unconfirmedTxsConfs2 = ''; // a silly way to keep track if anything changed in immature transactions
for (const tx of wallet.getTransactions()) {
if (tx.confirmations < 7) unconfirmedTxsConfs2 += tx.txid + ':' + tx.confirmations + ';';
}
if (unconfirmedTxsConfs2 !== immatureTxsConfs) {
smthChanged = true;
}
const end = +new Date();
console.log(wallet.getLabel(), 'fetch tx took', (end - start) / 1000, 'sec');
} catch (err) {
noErr = false;
presentAlert({ message: err.message });
setIsLoading(false);
setTimeElapsed(prev => prev + 1);
}
if (noErr && smthChanged) {
console.log('saving to disk');
await saveToDisk(); // caching
setDataSource([...getTransactionsSliced(limit)]);
}
setIsLoading(false);
setTimeElapsed(prev => prev + 1);
};
const _keyExtractor = (_item, index) => index.toString();
const renderListFooterComponent = () => {
// if not all txs rendered - display indicator
return (wallet.getTransactions().length > limit && <ActivityIndicator style={styles.activityIndicator} />) || <View />;
};
const renderListHeaderComponent = () => {
const style = {};
2021-05-29 07:57:40 +02:00
if (!isDesktop) {
// we need this button for testing
style.opacity = 0;
style.height = 1;
style.width = 1;
} else if (isLoading) {
style.opacity = 0.5;
} else {
style.opacity = 1.0;
}
return (
<View style={styles.flex}>
2021-09-09 13:00:11 +02:00
{wallet.type === LightningLdkWallet.type && (lnNodeInfo.canSend > 0 || lnNodeInfo.canReceive > 0) && (
<View style={[styles.marginHorizontal18, styles.marginBottom18]}>
<LNNodeBar canSend={lnNodeInfo.canSend} canReceive={lnNodeInfo.canReceive} itemPriceUnit={itemPriceUnit} />
</View>
)}
<View style={styles.listHeaderTextRow}>
<Text style={[styles.listHeaderText, stylesHook.listHeaderText]}>{loc.transactions.list_title}</Text>
2020-08-21 00:50:38 +02:00
</View>
</View>
);
};
2019-09-29 22:01:27 +02:00
const onWalletSelect = async selectedWallet => {
if (selectedWallet) {
navigate('WalletTransactions', {
walletType: wallet.type,
walletID: wallet.getID(),
key: `WalletTransactions-${wallet.getID()}`,
});
/** @type {LightningCustodianWallet} */
let toAddress = false;
if (wallet.refill_addressess.length > 0) {
toAddress = wallet.refill_addressess[0];
} else {
try {
await wallet.fetchBtcAddress();
toAddress = wallet.refill_addressess[0];
} catch (Err) {
return presentAlert({ message: Err.message });
}
2019-09-29 22:01:27 +02:00
}
navigate('SendDetailsRoot', {
2020-05-27 13:12:17 +02:00
screen: 'SendDetails',
params: {
memo: loc.lnd.refill_lnd_balance,
address: toAddress,
walletID: selectedWallet.getID(),
2020-05-27 13:12:17 +02:00
},
2019-09-29 22:01:27 +02:00
});
}
};
const navigateToSendScreen = () => {
navigate('SendDetailsRoot', {
2020-05-27 13:12:17 +02:00
screen: 'SendDetails',
params: {
walletID: wallet.getID(),
2020-05-27 13:12:17 +02:00
},
2020-01-01 04:31:04 +01:00
});
};
const renderItem = item => (
<TransactionListItem item={item.item} itemPriceUnit={itemPriceUnit} timeElapsed={timeElapsed} walletID={walletID} />
);
const onBarCodeRead = ret => {
if (!isLoading) {
setIsLoading(true);
const params = {
walletID: wallet.getID(),
uri: ret.data ? ret.data : ret,
};
if (wallet.chain === Chain.ONCHAIN) {
navigate('SendDetailsRoot', { screen: 'SendDetails', params });
} else {
navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params });
}
}
setIsLoading(false);
};
const choosePhoto = () => {
2024-03-13 22:44:53 +01:00
fs.showImagePickerAndReadImage()
.then(onBarCodeRead)
.catch(error => {
console.log(error);
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
presentAlert({ title: loc.errors.error, message: error.message });
});
};
2020-11-17 02:50:55 +01:00
const copyFromClipboard = async () => {
2023-03-30 02:46:11 +02:00
onBarCodeRead({ data: await BlueClipboard().getClipboardContent() });
};
2020-09-09 19:51:49 +02:00
const sendButtonPress = () => {
if (wallet.chain === Chain.OFFCHAIN) {
return navigate('ScanLndInvoiceRoot', { screen: 'ScanLndInvoice', params: { walletID: wallet.getID() } });
}
2020-09-09 19:51:49 +02:00
if (wallet.type === WatchOnlyWallet.type && wallet.isHd() && !wallet.useWithHardwareWalletEnabled()) {
return Alert.alert(
loc.wallets.details_title,
loc.transactions.enable_offline_signing,
[
{
text: loc._.ok,
onPress: async () => {
wallet.setUseWithHardwareWalletEnabled(true);
await saveToDisk();
navigateToSendScreen();
},
style: 'default',
},
{ text: loc._.cancel, onPress: () => {}, style: 'cancel' },
],
{ cancelable: false },
);
2020-09-07 19:46:37 +02:00
}
navigateToSendScreen();
2020-09-07 19:46:37 +02:00
};
const sendButtonLongPress = async () => {
2023-03-30 02:46:11 +02:00
const isClipboardEmpty = (await BlueClipboard().getClipboardContent()).trim().length === 0;
2024-03-13 22:44:53 +01:00
const options = [loc._.cancel, loc.wallets.list_long_choose, loc.wallets.list_long_scan];
const cancelButtonIndex = 0;
if (!isClipboardEmpty) {
options.push(loc.wallets.list_long_clipboard);
2023-02-25 17:24:06 +01:00
}
2024-03-13 22:44:53 +01:00
ActionSheet.showActionSheetWithOptions(
{
title: loc.send.header,
options,
cancelButtonIndex,
anchor: findNodeHandle(walletActionButtonsRef.current),
},
2024-03-13 22:54:32 +01:00
async buttonIndex => {
2024-03-13 22:44:53 +01:00
switch (buttonIndex) {
2024-03-13 22:46:22 +01:00
case 0:
2024-03-13 22:44:53 +01:00
break;
2024-03-13 22:46:22 +01:00
case 1:
2024-03-13 22:44:53 +01:00
choosePhoto();
break;
2024-03-13 22:46:22 +01:00
case 2:
scanQrHelper(name, true).then(data => onBarCodeRead(data));
2024-03-13 22:44:53 +01:00
break;
2024-03-13 22:46:22 +01:00
case 3:
2024-03-13 22:44:53 +01:00
if (!isClipboardEmpty) {
copyFromClipboard();
}
break;
}
},
);
};
2020-12-11 18:18:10 +01:00
const navigateToViewEditCosigners = () => {
2020-12-12 01:27:43 +01:00
navigate('ViewEditMultisigCosignersRoot', {
screen: 'ViewEditMultisigCosigners',
params: {
walletID,
2020-12-12 01:27:43 +01:00
},
2020-12-11 18:18:10 +01:00
});
};
2021-09-16 02:19:06 +02:00
const onManageFundsPressed = ({ id }) => {
2023-04-02 02:16:00 +02:00
if (id === actionKeys.Refill) {
2021-09-16 02:19:06 +02:00
const availableWallets = [...wallets.filter(item => item.chain === Chain.ONCHAIN && item.allowSend())];
if (availableWallets.length === 0) {
presentAlert({ message: loc.lnd.refill_create });
2021-09-16 02:19:06 +02:00
} else {
navigate('SelectWallet', { onWalletSelect, chainType: Chain.ONCHAIN });
}
2023-04-02 02:16:00 +02:00
} else if (id === actionKeys.RefillWithExternalWallet) {
2024-04-29 17:51:02 +02:00
navigate('ReceiveDetailsRoot', {
screen: 'ReceiveDetails',
params: {
walletID,
2024-04-29 17:51:02 +02:00
},
});
2021-09-16 02:19:06 +02:00
}
};
2023-10-20 19:47:37 +02:00
useEffect(() => {
setOptions({ statusBarStyle: 'light', barTintColor: WalletGradient.headerColorFor(wallet.type) });
}, [setOptions, wallet.type]);
const getItemLayout = (_, index) => ({
length: 64,
offset: 64 * index,
index,
});
useFocusEffect(
useCallback(() => {
const task = InteractionManager.runAfterInteractions(() => {
2024-02-15 23:35:21 +01:00
setReloadTransactionsMenuActionFunction(() => refreshTransactions);
});
return () => {
task.cancel();
setReloadTransactionsMenuActionFunction(() => {});
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []),
);
2024-02-16 15:42:21 +01:00
// Optimized for Mac option doesn't like RN Refresh component. Menu Elements now handles it for macOS
2024-02-16 16:13:17 +01:00
const refreshProps = isDesktop || isElectrumDisabled ? {} : { refreshing: isLoading, onRefresh: refreshTransactions };
return (
<View style={styles.flex}>
<TransactionsNavigationHeader
2022-12-07 03:43:54 +01:00
navigation={navigation}
wallet={wallet}
onWalletUnitChange={passedWallet =>
InteractionManager.runAfterInteractions(async () => {
setItemPriceUnit(passedWallet.getPreferredBalanceUnit());
saveToDisk();
})
}
2024-03-31 18:58:23 +02:00
onWalletBalanceVisibilityChange={async isShouldBeVisible => {
2024-05-18 00:34:39 +02:00
const isBiometricsEnabled = await isBiometricUseCapableAndEnabled();
2024-03-31 20:26:57 +02:00
if (wallet.hideBalance && isBiometricsEnabled) {
2024-05-18 00:34:39 +02:00
const unlocked = await unlockWithBiometrics();
2024-03-31 20:26:57 +02:00
if (!unlocked) {
throw new Error('Biometrics failed');
2024-03-31 18:58:23 +02:00
}
}
2024-03-31 20:26:57 +02:00
wallet.hideBalance = isShouldBeVisible;
2024-03-31 18:58:23 +02:00
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
await saveToDisk();
}}
2021-09-16 02:19:06 +02:00
onManageFundsPressed={id => {
if (wallet.type === MultisigHDWallet.type) {
2020-12-11 18:18:10 +01:00
navigateToViewEditCosigners();
2021-09-09 13:00:11 +02:00
} else if (wallet.type === LightningLdkWallet.type) {
navigate('LdkInfo', { walletID: wallet.getID() });
} else if (wallet.type === LightningCustodianWallet.type) {
if (wallet.getUserHasSavedExport()) {
2021-09-16 02:19:06 +02:00
onManageFundsPressed({ id });
2020-12-11 18:18:10 +01:00
} else {
2024-03-24 21:29:58 +01:00
presentWalletExportReminder()
.then(async () => {
wallet.setUserHasSavedExport(true);
2020-12-11 18:18:10 +01:00
await saveToDisk();
2021-09-16 02:19:06 +02:00
onManageFundsPressed({ id });
2024-03-24 21:29:58 +01:00
})
.catch(() => {
2020-12-11 18:18:10 +01:00
navigate('WalletExportRoot', {
screen: 'WalletExport',
params: {
walletID: wallet.getID(),
2020-12-11 18:18:10 +01:00
},
2024-03-24 21:29:58 +01:00
});
});
2020-12-11 18:18:10 +01:00
}
2019-08-04 08:42:05 +02:00
}
}}
/>
<View style={[styles.list, stylesHook.list]}>
<FlatList
getItemLayout={getItemLayout}
updateCellsBatchingPeriod={30}
ListHeaderComponent={renderListHeaderComponent}
onEndReachedThreshold={0.3}
onEndReached={async () => {
2020-11-17 02:50:55 +01:00
// pagination in works. in this block we will add more txs to FlatList
// so as user scrolls closer to bottom it will render mode transactions
if (getTransactionsSliced(Infinity).length < limit) {
// all list rendered. nop
return;
}
setDataSource(getTransactionsSliced(limit + pageSize));
setLimit(prev => prev + pageSize);
setPageSize(prev => prev * 2);
}}
ListFooterComponent={renderListFooterComponent}
ListEmptyComponent={
<ScrollView style={styles.flex} contentContainerStyle={styles.scrollViewContent}>
<Text numberOfLines={0} style={styles.emptyTxs}>
{(isLightning() && loc.wallets.list_empty_txs1_lightning) || loc.wallets.list_empty_txs1}
</Text>
{isLightning() && <Text style={styles.emptyTxsLightning}>{loc.wallets.list_empty_txs2_lightning}</Text>}
</ScrollView>
}
{...refreshProps}
data={dataSource}
2021-02-05 23:12:06 +01:00
extraData={[timeElapsed, dataSource, wallets]}
keyExtractor={_keyExtractor}
renderItem={renderItem}
initialNumToRender={10}
removeClippedSubviews
contentInset={{ top: 0, left: 0, bottom: 90, right: 0 }}
maxToRenderPerBatch={15}
windowSize={25}
2019-08-04 08:42:05 +02:00
/>
</View>
<FContainer ref={walletActionButtonsRef}>
{wallet.allowReceive() && (
2020-09-09 19:51:49 +02:00
<FButton
testID="ReceiveButton"
2020-09-09 19:51:49 +02:00
text={loc.receive.header}
onPress={() => {
if (wallet.chain === Chain.OFFCHAIN) {
navigate('LNDCreateInvoiceRoot', { screen: 'LNDCreateInvoice', params: { walletID: wallet.getID() } });
2020-09-09 19:51:49 +02:00
} else {
navigate('ReceiveDetailsRoot', { screen: 'ReceiveDetails', params: { walletID: wallet.getID() } });
2020-09-09 19:51:49 +02:00
}
}}
2020-09-09 19:51:49 +02:00
icon={
<View style={styles.receiveIcon}>
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
2020-09-09 19:51:49 +02:00
</View>
}
/>
2020-09-09 19:51:49 +02:00
)}
{(wallet.allowSend() || (wallet.type === WatchOnlyWallet.type && wallet.isHd())) && (
2020-09-09 19:51:49 +02:00
<FButton
onLongPress={sendButtonLongPress}
onPress={sendButtonPress}
text={loc.send.header}
testID="SendButton"
icon={
<View style={styles.sendIcon}>
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
2020-09-09 19:51:49 +02:00
</View>
}
/>
)}
</FContainer>
</View>
);
};
2020-07-15 19:32:59 +02:00
export default WalletTransactions;
2020-12-25 17:09:53 +01:00
WalletTransactions.navigationOptions = navigationStyle({}, (options, { theme, navigation, route }) => {
2020-07-15 19:32:59 +02:00
return {
headerRight: () => (
<TouchableOpacity
accessibilityRole="button"
2021-03-02 14:38:02 +01:00
testID="WalletDetails"
2020-07-15 19:32:59 +02:00
disabled={route.params.isLoading === true}
style={styles.walletDetails}
onPress={() =>
navigation.navigate('WalletDetails', {
walletID: route.params.walletID,
2020-07-15 19:32:59 +02:00
})
}
>
2022-06-19 18:17:33 +02:00
<Icon name="more-horiz" type="material" size={22} color="#FFFFFF" />
2020-07-15 19:32:59 +02:00
</TouchableOpacity>
),
2020-12-25 17:09:53 +01:00
title: '',
2020-07-15 19:32:59 +02:00
headerStyle: {
backgroundColor: WalletGradient.headerColorFor(route.params.walletType),
2020-07-15 19:32:59 +02:00
borderBottomWidth: 0,
elevation: 0,
// shadowRadius: 0,
shadowOffset: { height: 0, width: 0 },
},
headerTintColor: '#FFFFFF',
headerBackTitleVisible: false,
};
2020-12-25 17:09:53 +01:00
});
2022-12-07 03:43:54 +01:00
WalletTransactions.propTypes = {
navigation: PropTypes.shape(),
};
const styles = StyleSheet.create({
flex: {
flex: 1,
},
scrollViewContent: {
flex: 1,
justifyContent: 'center',
paddingHorizontal: 16,
paddingBottom: 40,
},
2021-09-09 13:00:11 +02:00
marginHorizontal18: {
marginHorizontal: 18,
},
marginBottom18: {
marginBottom: 18,
},
walletDetails: {
justifyContent: 'center',
alignItems: 'flex-end',
},
activityIndicator: {
marginVertical: 20,
},
listHeaderTextRow: {
flex: 1,
marginHorizontal: 16,
flexDirection: 'row',
justifyContent: 'space-between',
},
listHeaderText: {
marginTop: 8,
marginBottom: 8,
fontWeight: 'bold',
fontSize: 24,
},
list: {
flex: 1,
},
emptyTxs: {
fontSize: 18,
color: '#9aa0aa',
textAlign: 'center',
marginVertical: 16,
},
emptyTxsLightning: {
fontSize: 18,
color: '#9aa0aa',
textAlign: 'center',
fontWeight: '600',
},
sendIcon: {
2021-03-19 18:47:53 +01:00
transform: [{ rotate: I18nManager.isRTL ? '-225deg' : '225deg' }],
},
receiveIcon: {
2021-03-19 18:47:53 +01:00
transform: [{ rotate: I18nManager.isRTL ? '45deg' : '-45deg' }],
},
});