Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix: keep Android update toast above create button

tianma-if9123eaa28e48
diff --git a/apps/mobile/src/components/MobileUpdateToast.tsx b/apps/mobile/src/components/MobileUpdateToast.tsx
index 21140f1e..8dd0cbcc 100644
--- a/apps/mobile/src/components/MobileUpdateToast.tsx
+++ b/apps/mobile/src/components/MobileUpdateToast.tsx
@@ -11,6 +11,7 @@ import {
} from "../lib/preferences";
import { resolveMobileThemeStyles, useMobileTheme } from "../lib/mobile-theme";
import { useMobileUpdate } from "../lib/mobile-update";
+import { getMobileUpdateToastBottomOffset } from "../lib/mobile-update-toast-layout";
const AUTO_DISMISS_MS = 3_000;
const FADE_MS = 180;
@@ -113,7 +114,7 @@ export const MobileUpdateToast = () => {
style={[
styles.anchor,
{
- bottom: Math.max(insets.bottom, 12) + 12,
+ bottom: getMobileUpdateToastBottomOffset(insets.bottom),
opacity,
},
]}
diff --git a/apps/mobile/src/lib/mobile-update-toast-layout.test.ts b/apps/mobile/src/lib/mobile-update-toast-layout.test.ts
new file mode 100644
index 00000000..e6ee0086
--- /dev/null
+++ b/apps/mobile/src/lib/mobile-update-toast-layout.test.ts
@@ -0,0 +1,12 @@
+import { describe, expect, test } from "bun:test";
+import { getMobileUpdateToastBottomOffset } from "./mobile-update-toast-layout";
+
+describe("mobile update toast layout", () => {
+ test("clears the raised create button without a gesture inset", () => {
+ expect(getMobileUpdateToastBottomOffset(0)).toBe(92);
+ });
+
+ test("adds the Android gesture inset below the bottom navigation", () => {
+ expect(getMobileUpdateToastBottomOffset(24)).toBe(104);
+ });
+});
diff --git a/apps/mobile/src/lib/mobile-update-toast-layout.ts b/apps/mobile/src/lib/mobile-update-toast-layout.ts
new file mode 100644
index 00000000..7dd65231
--- /dev/null
+++ b/apps/mobile/src/lib/mobile-update-toast-layout.ts
@@ -0,0 +1,11 @@
+import { MOBILE_UI_METRICS } from "@edgeever/shared/mobile-ui";
+
+const MIN_SCREEN_EDGE_INSET = 12;
+const FLOATING_CONTROL_CLEARANCE = 12;
+
+/** Keep the update toast above the bottom navigation and its raised create button. */
+export const getMobileUpdateToastBottomOffset = (safeAreaBottom: number): number =>
+ Math.max(safeAreaBottom, MIN_SCREEN_EDGE_INSET)
+ + MOBILE_UI_METRICS.bottomNavigationHeight
+ + MOBILE_UI_METRICS.floatingCreateButtonLift
+ + FLOATING_CONTROL_CLEARANCE;
diff --git a/apps/mobile/src/screens/workspace-styles.ts b/apps/mobile/src/screens/workspace-styles.ts
index b04cc688..e70d7e5f 100644
--- a/apps/mobile/src/screens/workspace-styles.ts
+++ b/apps/mobile/src/screens/workspace-styles.ts
@@ -2120,7 +2120,7 @@ const baseWorkspaceStyles = StyleSheet.create({
borderWidth: 4,
height: MOBILE_UI_METRICS.floatingCreateButtonSize,
justifyContent: "center",
- marginTop: -16,
+ marginTop: -MOBILE_UI_METRICS.floatingCreateButtonLift,
shadowColor: "#10b981",
shadowOffset: { width: 0, height: 10 },
shadowOpacity: 0.28,
diff --git a/packages/shared/src/mobile-ui.test.mjs b/packages/shared/src/mobile-ui.test.mjs
index d4d47afe..6315085a 100644
--- a/packages/shared/src/mobile-ui.test.mjs
+++ b/packages/shared/src/mobile-ui.test.mjs
@@ -5,6 +5,7 @@ describe("mobile UI contract", () => {
test("keeps core touch targets and navigation metrics stable", () => {
expect(MOBILE_UI_METRICS.minimumTouchTarget).toBeGreaterThanOrEqual(44);
expect(MOBILE_UI_METRICS.bottomNavigationHeight).toBe(52);
+ expect(MOBILE_UI_METRICS.floatingCreateButtonLift).toBe(16);
expect(MOBILE_UI_METRICS.floatingCreateButtonSize).toBe(52);
});
diff --git a/packages/shared/src/mobile-ui.ts b/packages/shared/src/mobile-ui.ts
index 615da978..5fd73a9a 100644
--- a/packages/shared/src/mobile-ui.ts
+++ b/packages/shared/src/mobile-ui.ts
@@ -1,6 +1,7 @@
export const MOBILE_UI_METRICS = {
bottomNavigationHeight: 52,
compactControlHeight: 36,
+ floatingCreateButtonLift: 16,
floatingCreateButtonSize: 52,
floatingSheetCornerRadius: 10,
minimumTouchTarget: 44,