about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/index.tsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/routes/index.tsx b/src/routes/index.tsx
index a8a92e54f..5084473ec 100644
--- a/src/routes/index.tsx
+++ b/src/routes/index.tsx
@@ -1,5 +1,5 @@
-import React from 'react'
-import {Text} from 'react-native'
+import React, {useEffect} from 'react'
+import {Text, Linking} from 'react-native'
 import {
   NavigationContainer,
   LinkingOptions,
@@ -24,6 +24,7 @@ import {NotFound} from '../screens/NotFound'
 const linking: LinkingOptions<RootTabsParamList> = {
   prefixes: [
     'http://localhost:3000', // local dev
+    'https://pubsq.pfrazee.com', // test server (universal links only)
   ],
   config: {
     screens: {
@@ -59,6 +60,16 @@ const HIDE_TAB = {tabBarButton: () => null}
 export const Root = observer(() => {
   const store = useStores()
 
+  useEffect(() => {
+    console.log('Initial link setup')
+    Linking.getInitialURL().then((url: string | null) => {
+      console.log('Initial url', url)
+    })
+    Linking.addEventListener('url', ({url}) => {
+      console.log('Deep link opened with', url)
+    })
+  }, [])
+
   // hide the tabbar on desktop web
   const tabBar = platform.isDesktopWeb ? () => null : undefined