Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): stabilize navigation screen options

nothingyuancandodd139d78e45c
diff --git a/apps/mobile/src/__tests__/navigationOptionsStability.test.ts b/apps/mobile/src/__tests__/navigationOptionsStability.test.ts
new file mode 100644
index 0000000000..39807da16e
--- /dev/null
+++ b/apps/mobile/src/__tests__/navigationOptionsStability.test.ts
@@ -0,0 +1,20 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { describe, expect, it } from 'vitest';
+
+function readSource(relativePath: string): string {
+ return readFileSync(resolve(process.cwd(), relativePath), 'utf8').replace(/\r\n/g, '\n');
+}
+
+describe('navigation option stability', () => {
+ it('keeps login and system-back screen options stable across unrelated rerenders', () => {
+ const systemBack = readSource('src/platform/chrome/SystemNavigationBack.tsx');
+ expect(systemBack).toContain('const screenOptions = useMemo(() => ({');
+ expect(systemBack).toContain('<Stack.Screen options={screenOptions} />');
+ expect(systemBack).not.toContain('<Stack.Screen options={{');
+
+ const login = readSource('app/(auth)/login.tsx');
+ expect(login).toContain('const loginStatusBarOptions = useMemo(() => ({');
+ expect(login).toContain('<Stack.Screen options={loginStatusBarOptions} />');
+ });
+});