Skip to content

Commit df82a14

Browse files
[thirdweb] Fix hiddenWallets prop not applying to all wallets screen
1 parent 2725f33 commit df82a14

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

.changeset/dark-ravens-end.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix hiddenWallets prop not applying to all wallets screen

packages/thirdweb/src/react/native/ui/connect/ConnectModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ export function ConnectModal(
142142
const inAppWallet = wallets.find((wallet) => wallet.id === "inApp") as
143143
| Wallet<"inApp">
144144
| undefined;
145-
const externalWallets = wallets.filter((wallet) => wallet.id !== "inApp");
145+
const externalWallets = wallets
146+
.filter((wallet) => wallet.id !== "inApp")
147+
.filter((wallet) => !props.hiddenWallets?.includes(wallet.id));
146148
const showBranding = props.connectModal?.showThirdwebBranding !== false;
147149
const connectionManager = useConnectionManager();
148150

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/AllWalletsUI.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import walletInfos from "../../../../../wallets/__generated__/wallet-infos.js";
88
import { NON_SEARCHABLE_WALLETS } from "../../../../../wallets/constants.js";
99
import { createWallet } from "../../../../../wallets/create-wallet.js";
1010
import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
11+
import type { WalletId } from "../../../../../wallets/wallet-types.js";
1112
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
1213
import { iconSize, spacing } from "../../../../core/design-system/index.js";
1314
import { useSetSelectionData } from "../../../providers/wallet-ui-states-provider.js";
@@ -34,15 +35,16 @@ function AllWalletsUI(props: {
3435
recommendedWallets: Wallet[] | undefined;
3536
connectLocale: ConnectLocale;
3637
disableSelectionDataReset?: boolean;
38+
walletIdsToHide?: WalletId[];
3739
}) {
3840
const { itemsToShow, lastItemRef } = useShowMore<HTMLLIElement>(10, 10);
3941
const setSelectionData = useSetSelectionData();
4042

4143
const walletList = useMemo(() => {
42-
return walletInfos.filter(
43-
(info) => !NON_SEARCHABLE_WALLETS.includes(info.id),
44-
);
45-
}, []);
44+
return walletInfos
45+
.filter((info) => !NON_SEARCHABLE_WALLETS.includes(info.id))
46+
.filter((info) => !props.walletIdsToHide?.includes(info.id));
47+
}, [props.walletIdsToHide]);
4648

4749
const fuseInstance = useMemo(() => {
4850
return new Fuse(walletList, {

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export const ConnectModalContent = (props: {
172172
onBack={handleBack}
173173
onSelect={setScreen}
174174
recommendedWallets={props.recommendedWallets}
175+
walletIdsToHide={props.walletIdsToHide}
175176
size={props.size}
176177
/>
177178
</Suspense>

0 commit comments

Comments
 (0)