diff --git a/Navigation.tsx b/Navigation.tsx index 7f10794b5..1fd167a15 100644 --- a/Navigation.tsx +++ b/Navigation.tsx @@ -64,7 +64,7 @@ import PaymentCode from './screen/wallets/paymentCode'; import PaymentCodesList from './screen/wallets/paymentCodesList'; import { BlueStorageContext } from './blue_modules/storage-context'; import { useIsLargeScreen } from './hooks/useIsLargeScreen'; -import { HeaderRightButton } from './components/HeaderRightButton'; +import HeaderRightButton from './components/HeaderRightButton'; import WalletExportStack from './navigation/WalletExportStack'; import SendDetailsStack from './navigation/SendDetailsStack'; import LNDCreateInvoiceRoot from './navigation/LNDCreateInvoiceStack'; @@ -171,9 +171,7 @@ const DetailViewStackScreensStack = () => { navigation.dispatch(StackActions.popToTop()); }; - const SaveButton = useMemo(() => { - return ; - }, []); + const SaveButton = useMemo(() => , []); return ( { headerStyle: { backgroundColor: theme.colors.customHeader, }, + headerRight: () => SaveButton, })(theme)} /> diff --git a/components/HeaderRightButton.tsx b/components/HeaderRightButton.tsx index 84193ed4d..65e9a91cd 100644 --- a/components/HeaderRightButton.tsx +++ b/components/HeaderRightButton.tsx @@ -1,15 +1,15 @@ +import React from 'react'; import { StyleSheet, TouchableOpacity, Text } from 'react-native'; import { useTheme } from './themes'; -import React from 'react'; interface HeaderRightButtonProps { - disabled: boolean; + disabled?: boolean; onPress?: () => void; title: string; testID?: string; } -export const HeaderRightButton: React.FC = ({ disabled = true, onPress, title, testID }) => { +const HeaderRightButton: React.FC = ({ disabled = true, onPress, title, testID }) => { const { colors } = useTheme(); return ( ; @@ -61,12 +62,6 @@ const TransactionDetails = () => { Link: { color: colors.buttonTextColor, }, - save: { - backgroundColor: colors.lightButton, - }, - saveText: { - color: colors.buttonTextColor, - }, }); const handleOnSaveButtonTapped = useCallback(() => { @@ -82,23 +77,16 @@ const TransactionDetails = () => { }); }, [tx, txMetadata, memo, counterpartyLabel, paymentCode, saveToDisk, counterpartyMetadata]); - const HeaderRightButton = useMemo(() => { - return ( - - {loc.wallets.details_save} - - ); - }, [isLoading, stylesHooks.save, stylesHooks.saveText, handleOnSaveButtonTapped]); + const HeaderRight = useMemo( + () => , + + [isLoading, handleOnSaveButtonTapped], + ); useEffect(() => { // This effect only handles changes in `colors` - setOptions({ headerRight: () => HeaderRightButton }); - }, [colors, HeaderRightButton, setOptions]); + setOptions({ headerRight: () => HeaderRight }); + }, [colors, HeaderRight, setOptions]); useFocusEffect( useCallback(() => { @@ -200,6 +188,17 @@ const TransactionDetails = () => { }); }; + const onPressMenuItem = (key: string) => { + if (key === TransactionDetails.actionKeys.CopyToClipboard) { + handleCopyPress(key); + } else if (key === TransactionDetails.actionKeys.GoToWallet) { + const wallet = weOwnAddress(key); + if (wallet) { + navigateToWallet(wallet); + } + } + }; + const renderSection = (array: any[]) => { const fromArray = []; @@ -220,20 +219,7 @@ const TransactionDetails = () => { } fromArray.push( - { - if (id === TransactionDetails.actionKeys.CopyToClipboard) { - handleCopyPress(address); - } else if (id === TransactionDetails.actionKeys.GoToWallet) { - isWeOwnAddress && navigateToWallet(isWeOwnAddress); - } - }} - > + {address} {index === array.length - 1 ? null : ','} @@ -400,17 +386,6 @@ const styles = StyleSheet.create({ weOwnAddress: { fontWeight: '700', }, - save: { - alignItems: 'center', - justifyContent: 'center', - width: 80, - borderRadius: 8, - height: 34, - }, - saveText: { - fontSize: 15, - fontWeight: '600', - }, memoTextInput: { flexDirection: 'row', borderWidth: 1, diff --git a/screen/wallets/details.js b/screen/wallets/details.js index f3165b5f0..e9f8f6ea6 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -45,7 +45,7 @@ import loc, { formatBalanceWithoutSuffix } from '../../loc'; import { BitcoinUnit, Chain } from '../../models/bitcoinUnits'; import SaveFileButton from '../../components/SaveFileButton'; import { useSettings } from '../../components/Context/SettingsContext'; -import { HeaderRightButton } from '../../components/HeaderRightButton'; +import HeaderRightButton from '../../components/HeaderRightButton'; import { writeFileAndExport } from '../../blue_modules/fs'; const styles = StyleSheet.create({