Files
Dhairyashil ShindeandGitHub fa53f54815 feat(companion): add configurable landing page (#27267)
* feat(companion): add configurable landing page feature

- Add useUserPreferences hook for persistent storage of landing page preference
- Add LandingPagePicker component for both iOS and Android/web platforms
- Update tabs index to redirect based on user preference
- Update bookings index to accept initial filter from URL params
- Add App Settings section in More screen with landing page selector
- Clear user preferences on logout for fresh state

* fix(companion): remove try-finally for React Compiler compatibility

* fix(companion): use router.replace for dynamic landing page redirect

Replace Redirect component with router.replace() to fix TypeScript
strict typing issue with expo-router's Href type for dynamic routes.

* fix(companion): use literal route strings for TypeScript strict typing

Use switch statement with literal route strings instead of dynamic
string variable to satisfy expo-router's strict Href type checking.

* working fix

* better css
2026-02-13 11:28:42 -03:00

22 lines
799 B
TypeScript

import { Redirect } from "expo-router";
import { ActivityIndicator, View } from "react-native";
import { getRouteFromPreference, useUserPreferences } from "@/hooks/useUserPreferences";
export default function TabsIndex() {
const { preferences, isLoading } = useUserPreferences();
if (isLoading) {
return (
<View className="flex-1 items-center justify-center bg-white">
<ActivityIndicator size="small" color="#111827" />
</View>
);
}
const route = getRouteFromPreference(preferences.landingPage);
console.log("[TabsIndex] Redirecting to:", route, "from preference:", preferences.landingPage);
// biome-ignore lint/suspicious/noExplicitAny: expo-router types don't support dynamic route strings from preferences
return <Redirect href={route as any} />;
}