This article is an English translation of the original Japanese article.
In my club management app, I use the following invite URL for both web and iOS app:
https://squad-note.com/invite/{orgId}
If the app is installed, Expo Router opens the invite screen in the app. If not, the web page displays. Using Universal Links lets me share a single URL rather than splitting it into web and app versions.
Expo Router File Structure
I place the invite screen as a dynamic route.
apps/mobile/src/app/invite/[orgId]/index.tsx
The screen retrieves the orgId from the URL via useLocalSearchParams.
import { useLocalSearchParams, useRouter } from "expo-router";
export default function InviteScreen() {
const { orgId } = useLocalSearchParams<{ orgId: string }>();
const router = useRouter();
const { data: org, isLoading } = api.organization.getPublic.useQuery(
{ id: orgId! },
{ enabled: !!orgId },
);
// Display invite content and execute join proc
Discussion
Jump in and comment!
Get the ball rolling with your comment!