Skip to content

Commit

Permalink
add deep link
Browse files Browse the repository at this point in the history
  • Loading branch information
sciretta committed Mar 9, 2022
1 parent b0dd8a3 commit c53f7d3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="app" android:scheme="cuplr" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Expand Down
23 changes: 23 additions & 0 deletions src/linking.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const config = {
screens: {
// Home: {
// path: 'home/:id',
// parse: {
// id: (id) => `${id}`,
// },
// },
// Profile: {
// path: 'profile/:id',
// parse: {
// id: (id) => `${id}`,
// },
// },
Notifications: 'notifications',
Settings: 'settings',
},
};

export const linking = {
prefixes: ['cuplr://app'],
config,
};
3 changes: 2 additions & 1 deletion src/shared/navigation/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DefaultTheme, NavigationContainer } from '@react-navigation/native';

import { MainStack } from './MainStackNavigator';
import { theme } from '../../constants/theme';
import { linking } from '../../linking';

export const AppNavigator = (): ReactElement => {
const navigationTheme = {
Expand All @@ -14,7 +15,7 @@ export const AppNavigator = (): ReactElement => {
};

return (
<NavigationContainer theme={navigationTheme}>
<NavigationContainer theme={navigationTheme} linking={linking}>
<MainStack />
</NavigationContainer>
);
Expand Down

0 comments on commit c53f7d3

Please sign in to comment.