ADD: Navigate to selected wallet

This commit is contained in:
Marcos Rodriguez Vélez 2022-01-27 17:32:00 -05:00
parent fe89b10e50
commit 24bade8862
No known key found for this signature in database
GPG Key ID: 0D64671698D11C5C
2 changed files with 17 additions and 13 deletions

View File

@ -31,19 +31,11 @@ type RNGHFlatListProps<T> = Animated.AnimateProps<
} }
>; >;
const AnimatedFlatList = (Animated.createAnimatedComponent(FlatList) as unknown) as <T>(props: RNGHFlatListProps<T>) => React.ReactElement; const AnimatedFlatList = Animated.createAnimatedComponent(FlatList) as unknown as <T>(props: RNGHFlatListProps<T>) => React.ReactElement;
function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) { function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
const { const { cellDataRef, containerRef, flatListRef, isTouchActiveRef, keyToIndexRef, panGestureHandlerRef, propsRef, scrollOffsetRef } =
cellDataRef, useRefs<T>();
containerRef,
flatListRef,
isTouchActiveRef,
keyToIndexRef,
panGestureHandlerRef,
propsRef,
scrollOffsetRef,
} = useRefs<T>();
const { const {
activationDistance, activationDistance,
activeCellOffset, activeCellOffset,

View File

@ -4,7 +4,7 @@ import { BluePrivateBalance } from '../../BlueComponents';
import DraggableFlatList, { ScaleDecorator } from '../../components/react-native-draggable-flatlist'; import DraggableFlatList, { ScaleDecorator } from '../../components/react-native-draggable-flatlist';
import LinearGradient from 'react-native-linear-gradient'; import LinearGradient from 'react-native-linear-gradient';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { useTheme } from '@react-navigation/native'; import { useNavigation, useTheme } from '@react-navigation/native';
import navigationStyle from '../../components/navigationStyle'; import navigationStyle from '../../components/navigationStyle';
import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet } from '../../class'; import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet } from '../../class';
import WalletGradient from '../../class/wallet-gradient'; import WalletGradient from '../../class/wallet-gradient';
@ -78,6 +78,8 @@ const ReorderWallets = () => {
const sortableList = useRef(); const sortableList = useRef();
const { colors } = useTheme(); const { colors } = useTheme();
const { wallets, setWalletsWithNewOrder } = useContext(BlueStorageContext); const { wallets, setWalletsWithNewOrder } = useContext(BlueStorageContext);
const { navigate } = useNavigation();
const stylesHook = { const stylesHook = {
root: { root: {
backgroundColor: colors.elevated, backgroundColor: colors.elevated,
@ -95,12 +97,22 @@ const ReorderWallets = () => {
setWalletData(wallets); setWalletData(wallets);
}, [wallets]); }, [wallets]);
const navigateToWallet = wallet => {
const walletID = wallet.getID();
navigate('WalletTransactions', {
walletID,
walletType: wallet.type,
key: `WalletTransactions-${walletID}`,
});
};
const renderItem = ({ item, drag, isActive }) => { const renderItem = ({ item, drag, isActive }) => {
return ( return (
<ScaleDecorator> <ScaleDecorator>
<Pressable <Pressable
disabled={isActive} disabled={isActive}
onPressIn={drag} onLongPress={drag}
onPress={() => navigateToWallet(item)}
shadowOpacity={40 / 100} shadowOpacity={40 / 100}
shadowOffset={{ width: 0, height: 0 }} shadowOffset={{ width: 0, height: 0 }}
shadowRadius={5} shadowRadius={5}