about summary refs log tree commit diff
path: root/src/App.native.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-21 16:07:26 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-11-21 16:07:26 -0600
commited146a582c140b9a472298390dafbc07bd06cf60 (patch)
treebd540e4a84244fdbdbdf5fde412fc4a179b6dae5 /src/App.native.tsx
parent39058cd36a9839df0e0c7e30ba486a09e30f169c (diff)
downloadvoidsky-ed146a582c140b9a472298390dafbc07bd06cf60.tar.zst
Add web linking and proper share controls
Diffstat (limited to 'src/App.native.tsx')
-rw-r--r--src/App.native.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx
index 3d3e5f1b0..65a77c3dc 100644
--- a/src/App.native.tsx
+++ b/src/App.native.tsx
@@ -1,5 +1,6 @@
 import 'react-native-url-polyfill/auto'
 import React, {useState, useEffect} from 'react'
+import {Linking} from 'react-native'
 import {RootSiblingParent} from 'react-native-root-siblings'
 import {GestureHandlerRootView} from 'react-native-gesture-handler'
 import SplashScreen from 'react-native-splash-screen'
@@ -24,6 +25,14 @@ function App() {
       .then(store => {
         setRootStore(store)
         SplashScreen.hide()
+        Linking.getInitialURL().then((url: string | null) => {
+          if (url) {
+            store.nav.handleLink(url)
+          }
+        })
+        Linking.addEventListener('url', ({url}) => {
+          store.nav.handleLink(url)
+        })
       })
   }, [])