diff options
author | Hailey <me@haileyok.com> | 2024-03-01 16:04:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 16:04:06 -0800 |
commit | e950463f71bddbcf83926dcfd681320a53192c7a (patch) | |
tree | d978e029512f5cab11ecce4b22b912f419deda3c /src/Navigation.tsx | |
parent | 8bf40b46a00fd130a614b3446c98df1d421f970e (diff) | |
download | voidsky-e950463f71bddbcf83926dcfd681320a53192c7a.tar.zst |
Fix new post button on web after following intent URL (#3044)
* Fix new post button on web after following intent URL * Ensure that `routes` exists before attempting to use it
Diffstat (limited to 'src/Navigation.tsx')
-rw-r--r-- | src/Navigation.tsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Navigation.tsx b/src/Navigation.tsx index c650c1f40..b30f8f982 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -485,12 +485,19 @@ const LINKING = { }, getStateFromPath(path: string) { + const [name, params] = router.matchPath(path) + // Any time we receive a url that starts with `intent/` we want to ignore it here. It will be handled in the // intent handler hook. We should check for the trailing slash, because if there isn't one then it isn't a valid // intent - if (path.includes('intent/')) return + // On web, there is no route state that's created by default, so we should initialize it as the home route. On + // native, since the home tab and the home screen are defined as initial routes, we don't need to return a state + // since it will be created by react-navigation. + if (path.includes('intent/')) { + if (isNative) return + return buildStateObject('Flat', 'Home', params) + } - const [name, params] = router.matchPath(path) if (isNative) { if (name === 'Search') { return buildStateObject('SearchTab', 'Search', params) |