feat(mobile): emit screen change events on route appearance and disappearance
- Added event emissions for screen changes when a route appears or disappears, including the screen ID and route details. - Updated the ScreenChangeEventPayload type to optionally include route information. These changes enhance navigation tracking within the mobile application. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
parent
18081805c2
commit
fca0a94e6e
|
|
@ -42,6 +42,7 @@ export class Navigation {
|
|||
route.id = `${route.id}-${this.viewIdCounter++}`
|
||||
}
|
||||
jotaiStore.set(this.ctxValue.routesAtom, [...routes, route])
|
||||
this.emit("screenChange", { screenId: route.id, type: "appear", route })
|
||||
}
|
||||
|
||||
private resolveScreenOptions<T>(
|
||||
|
|
@ -94,6 +95,7 @@ export class Navigation {
|
|||
return
|
||||
}
|
||||
jotaiStore.set(this.ctxValue.routesAtom, routes.slice(0, -1))
|
||||
this.emit("screenChange", { screenId: lastRoute.id, type: "disappear", route: lastRoute })
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -177,4 +179,5 @@ type LifecycleEventPayload = {
|
|||
type ScreenChangeEventPayload = {
|
||||
screenId: string
|
||||
type: "appear" | "disappear"
|
||||
route?: Route
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue