Skip to content

Commit 24465bf

Browse files
feat: add native-like page transitions for Android
- Added `RouteTransitions` utility. - Configured TanStack Router `defaultViewTransition`. - Added `transitions.css` with push/pop animations. - Wired up Android back button in `App.tsx`. - Added `tauri-plugin-app` to backend to ensure back button event works. - Added documentation and unit tests.
1 parent 515051c commit 24465bf

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

apps/window-alarm/src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tauri-build = { version = "2.0.0", features = [] }
1515
tauri = { version = "2.0.0", features = [] }
1616
log = "0.4"
1717
tauri-plugin-sql = { version = "2.0.0", features = ["sqlite"] }
18+
tauri-plugin-app = { version = "2.0.0", features = [] }
1819
tauri-plugin-alarm-manager = { path = "../../../plugins/alarm-manager" }
1920
tauri-plugin-deep-link = { version = "2.0.0", features = [] }
2021
tauri-plugin-log = { version = "2.0.0", features = [] }

apps/window-alarm/src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub fn run() {
6060

6161
builder
6262
.plugin(tauri_plugin_sql::Builder::default().build())
63+
.plugin(tauri_plugin_app::init())
6364
.plugin(tauri_plugin_alarm_manager::init())
6465
.plugin(tauri_plugin_deep_link::init())
6566
.plugin(tauri_plugin_notification::init())

apps/window-alarm/src/router.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const routeTree = rootRoute.addChildren([indexRoute, homeRoute, editAlarmRoute,
8585
export const router = createRouter({
8686
routeTree,
8787
defaultNotFoundComponent: NotFound,
88-
defaultViewTransition: ({ location }) => {
88+
defaultViewTransition: (({ location }: { location: any }) => {
8989
// 1. Check if allowed
9090
if (!routeTransitions.shouldAnimate()) {
9191
return false;
@@ -109,7 +109,7 @@ export const router = createRouter({
109109
return {
110110
types: ['wa-slide', `wa-${direction}`]
111111
};
112-
}
112+
}) as any
113113
});
114114

115115
declare module '@tanstack/react-router' {

0 commit comments

Comments
 (0)