BlueWallet/navigation/helpers/getWalletTransactionsOptions.tsx

50 lines
1.6 KiB
TypeScript
Raw Normal View History

2024-08-12 17:27:19 -04:00
import React from 'react';
import { TouchableOpacity, StyleSheet } from 'react-native';
import { Icon } from '@rneui/themed';
import WalletGradient from '../../class/wallet-gradient';
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
import { DetailViewStackParamList } from '../DetailViewStackParamList';
import { navigationRef } from '../../NavigationService';
2024-08-24 15:11:06 -04:00
import { RouteProp } from '@react-navigation/native';
2024-08-12 17:27:19 -04:00
2024-08-24 15:11:06 -04:00
export type WalletTransactionsRouteProps = RouteProp<DetailViewStackParamList, 'WalletTransactions'>;
2024-08-12 17:27:19 -04:00
2024-08-24 15:11:06 -04:00
const getWalletTransactionsOptions = ({ route }: { route: WalletTransactionsRouteProps }): NativeStackNavigationOptions => {
2024-08-12 17:27:19 -04:00
const { isLoading, walletID, walletType } = route.params;
const onPress = () => {
navigationRef.navigate('WalletDetails', {
walletID,
});
};
2024-08-24 21:11:20 -04:00
2024-08-12 17:27:19 -04:00
const RightButton = (
<TouchableOpacity accessibilityRole="button" testID="WalletDetails" disabled={isLoading} style={styles.walletDetails} onPress={onPress}>
<Icon name="more-horiz" type="material" size={22} color="#FFFFFF" />
</TouchableOpacity>
);
const backgroundColor = WalletGradient.headerColorFor(walletType);
return {
title: '',
headerBackTitleStyle: { fontSize: 0 },
headerStyle: {
backgroundColor,
},
headerShadowVisible: false,
headerTintColor: '#FFFFFF',
headerBackTitleVisible: true,
headerRight: () => RightButton,
};
};
const styles = StyleSheet.create({
walletDetails: {
justifyContent: 'center',
alignItems: 'flex-end',
},
});
export default getWalletTransactionsOptions;