Skip to content

Commit

Permalink
feat: setup deeplinks (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsyirvo authored Apr 17, 2024
1 parent e66a117 commit 68b1ddf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
name: Env.APP_NAME,
description: `${Env.APP_NAME} Mobile App`,
owner: Env.EXPO_ACCOUNT_OWNER,
scheme: 'rn-starter',
slug: 'rn-starter',
version: Env.VERSION.toString(),
runtimeVersion: '1.0.0',
Expand Down
2 changes: 2 additions & 0 deletions src/core/navigation/RootStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useAppStateTracking } from './hooks/useAppStateTracking';
import { useNavigationState } from './hooks/useNavigationState';
import { screens } from './screens';
import type { RootStackParamList } from './types/navigation.types';
import { deepLinks } from './utils/deepLinks';

const Stack = createNativeStackNavigator<RootStackParamList>();

Expand All @@ -21,6 +22,7 @@ export const RootStack = () => {
return (
<NavigationContainer
ref={navigationRef}
linking={deepLinks}
onReady={onNavigationReady}
onStateChange={onStateChange}
>
Expand Down
15 changes: 15 additions & 0 deletions src/core/navigation/utils/deepLinks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as Linking from 'expo-linking';

const prefix = Linking.createURL('/');

export const deepLinks = {
prefixes: [prefix],
config: {
screens: {
HomeScreen: 'home',
OtherScreen: 'other-screen',
BlogPostScreen: 'blog-post',
DummyFormScreen: 'dummy-form',
},
},
};

0 comments on commit 68b1ddf

Please sign in to comment.