Fix deeplink when app is suspended (#812)
* Update Navigation.tsx Missing If statement within the Deep Linking function that broke the ability to change state to hometab * Updated the function correctly, I missed a bracket * format * add pre-existing home state when unspecified path * Remove unnecessary log --------- Co-authored-by: Gai <68623807+that-gai-gai@users.noreply.github.com> Co-authored-by: that-gai-gai <kgai@protonmail.com>zio/stable
parent
421f29ad98
commit
3cb8169a4f
|
@ -410,7 +410,16 @@ const LINKING = {
|
||||||
if (name === 'Notifications') {
|
if (name === 'Notifications') {
|
||||||
return buildStateObject('NotificationsTab', 'Notifications', params)
|
return buildStateObject('NotificationsTab', 'Notifications', params)
|
||||||
}
|
}
|
||||||
return buildStateObject('HomeTab', name, params)
|
if (name === 'Home') {
|
||||||
|
return buildStateObject('HomeTab', 'Home', params)
|
||||||
|
}
|
||||||
|
// if the path is something else, like a post, profile, or even settings, we need to initialize the home tab as pre-existing state otherwise the back button will not work
|
||||||
|
return buildStateObject('HomeTab', name, params, [
|
||||||
|
{
|
||||||
|
name: 'Home',
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
])
|
||||||
} else {
|
} else {
|
||||||
return buildStateObject('Flat', name, params)
|
return buildStateObject('Flat', name, params)
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,15 @@ export function getTabState(state: State | undefined, tab: string): TabState {
|
||||||
return TabState.Outside
|
return TabState.Outside
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExistingState = {
|
||||||
|
name: string
|
||||||
|
params?: RouteParams
|
||||||
|
}
|
||||||
export function buildStateObject(
|
export function buildStateObject(
|
||||||
stack: string,
|
stack: string,
|
||||||
route: string,
|
route: string,
|
||||||
params: RouteParams,
|
params: RouteParams,
|
||||||
|
state: ExistingState[] = [],
|
||||||
) {
|
) {
|
||||||
if (stack === 'Flat') {
|
if (stack === 'Flat') {
|
||||||
return {
|
return {
|
||||||
|
@ -70,7 +75,7 @@ export function buildStateObject(
|
||||||
{
|
{
|
||||||
name: stack,
|
name: stack,
|
||||||
state: {
|
state: {
|
||||||
routes: [{name: route, params}],
|
routes: [...state, {name: route, params}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue