Skip to content

Commit

Permalink
Properly rerender list for selected token transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanvl committed Oct 16, 2024
1 parent 47e06fe commit 38f8463
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions views/TransferToken/TransferTokenAmount.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { MESSAGE_TYPES } from '../../scripts/helpers/constants';
import { getDRC20Inscriptions } from '../../scripts/helpers/doginals';
import { sendMessage } from '../../scripts/helpers/message';
import { NFT } from '../Transactions/components/NFT';
import { set } from 'bitcore-lib-doge/lib/hdkeycache';

export const TransferTokenAmount = ({
setFormPage,
Expand Down Expand Up @@ -72,11 +73,11 @@ export const TransferTokenAmount = ({
onPress={() => {
setSelectedNFT(item);
}}
selected={selectedNFT?.txid === item.txid}
selected={selectedNFT?.location === item.location}
/>
);
},
[selectedNFT?.txid, setSelectedNFT]
[selectedNFT?.location, setSelectedNFT]
);

const onSubmit = useCallback(() => {
Expand Down Expand Up @@ -145,7 +146,7 @@ export const TransferTokenAmount = ({
<FlatList
data={nfts}
renderItem={renderItem}
keyExtractor={(item) => item.inscriptionNumber}
keyExtractor={(item) => selectedNFT?.location + item.location}
numColumns={2}
initialNumToRender={4}
/>
Expand All @@ -162,7 +163,10 @@ export const TransferTokenAmount = ({
<Button
variant='unstyled'
colorScheme='coolGray'
onPress={() => setFormPage('address')}
onPress={() => {
setSelectedNFT(null);
setFormPage('address');
}}
alignSelf='center'
>
Back
Expand Down

0 comments on commit 38f8463

Please sign in to comment.