From 3f71ebd779327f2cb842650aaed03e263b4a204f Mon Sep 17 00:00:00 2001 From: vineyardbovines Date: Fri, 26 Jun 2026 12:01:46 -0400 Subject: [PATCH] fix(invite): normalize canAddPasses() return for simulator runtimes The native module's TS signature is Promise, but the iOS simulator can return undefined synchronously since PassKit isn't fully wired there. Wrap in Promise.resolve so both shapes flow through the same .then/.catch path. --- .../inviteFriends/components/AddToWalletButton.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/features/inviteFriends/components/AddToWalletButton.tsx b/src/features/inviteFriends/components/AddToWalletButton.tsx index 480d0f0890..9a28d8c81e 100644 --- a/src/features/inviteFriends/components/AddToWalletButton.tsx +++ b/src/features/inviteFriends/components/AddToWalletButton.tsx @@ -23,9 +23,12 @@ export function AddToWalletButton({handle}: {handle: string}) { // Skip the native check if the handle is already known to be unusable. if (!handle || handle === 'handle.invalid') return let cancelled = false - ;(RNWallet.canAddPasses() as Promise) - .then((ok: boolean) => { - if (!cancelled) setCanAdd(ok) + // The native module's TS signature is Promise, but on the iOS + // simulator PassKit isn't fully wired and canAddPasses() can return + // undefined synchronously - Promise.resolve normalizes both shapes. + Promise.resolve(RNWallet.canAddPasses() as Promise | undefined) + .then(ok => { + if (!cancelled) setCanAdd(ok === true) }) .catch(() => { if (!cancelled) setCanAdd(false)