feat(app): React Navigation shell and i18next setup

- React Navigation 7: conditional root stack (Auth | Main | Repository |
  Settings | Accounts modal), 5 bottom tabs with nested native stacks
- typed param lists, deep-link config, header options, root-nav helper
- providers: gesture handler, safe area, theme, persisted query client, app lock
- i18next + expo-localization (en/nl), persisted language preference
This commit is contained in:
JustZoe101 committed 2026-10-09 16:41:17 +02:00
1 parent 08229fdf86
commit ad81db07b3
17 files changed
+1500

No files matched your search

+98
View File
@@ -0,0 +1,98 @@
/**
* Repository stack: pushed on top of the tab shell from anywhere a repository
* is opened (search, home, inbox, deep links).
*/
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { useTranslation } from 'react-i18next';
import { HeaderAccountAndSettings } from '@/components/layout/header-buttons';
import { BranchesScreen } from '@/features/repository/screens/branches-screen';
import { CommitDetailScreen } from '@/features/repository/screens/commit-detail-screen';
import { CommitsScreen } from '@/features/repository/screens/commits-screen';
import { FileViewerScreen } from '@/features/repository/screens/file-viewer-screen';
import { FilesScreen } from '@/features/repository/screens/files-screen';
import { IssueDetailScreen } from '@/features/repository/screens/issue-detail-screen';
import { PullDetailScreen } from '@/features/repository/screens/pull-detail-screen';
import { RepoIssuesScreen } from '@/features/repository/screens/repo-issues-screen';
import { RepoOverviewScreen } from '@/features/repository/screens/repo-overview-screen';
import { RepoPullsScreen } from '@/features/repository/screens/repo-pulls-screen';
import { TagsScreen } from '@/features/repository/screens/tags-screen';
import { shortSha } from '@/core/utils/format';
import { useStackScreenOptions } from '@/navigation/header-options';
import type { RepositoryStackParamList } from '@/navigation/types';
const Stack = createNativeStackNavigator<RepositoryStackParamList>();
function lastSegment(path: string | undefined, fallback: string): string {
if (!path) return fallback;
const segments = path.split('/').filter(Boolean);
return segments[segments.length - 1] ?? fallback;
}
export function RepositoryNavigator() {
const { t } = useTranslation();
const base = useStackScreenOptions();
return (
<Stack.Navigator
screenOptions={{ ...base, headerRight: () => <HeaderAccountAndSettings /> }}
>
<Stack.Screen
name="RepoOverview"
component={RepoOverviewScreen}
options={({ route }) => ({ title: `${route.params.owner}/${route.params.name}` })}
/>
<Stack.Screen
name="Files"
component={FilesScreen}
options={({ route }) => ({
title: lastSegment(route.params.path, t('repo.files')),
})}
/>
<Stack.Screen
name="FileViewer"
component={FileViewerScreen}
options={({ route }) => ({
title: lastSegment(route.params.path, t('files.title')),
})}
/>
<Stack.Screen
name="Commits"
component={CommitsScreen}
options={{ title: t('repo.commits') }}
/>
<Stack.Screen
name="CommitDetail"
component={CommitDetailScreen}
options={({ route }) => ({ title: shortSha(route.params.sha) })}
/>
<Stack.Screen
name="Branches"
component={BranchesScreen}
options={{ title: t('repo.branches') }}
/>
<Stack.Screen name="Tags" component={TagsScreen} options={{ title: t('repo.tags') }} />
<Stack.Screen
name="RepoIssues"
component={RepoIssuesScreen}
options={{ title: t('repo.issuesTab') }}
/>
<Stack.Screen
name="IssueDetail"
component={IssueDetailScreen}
options={({ route }) => ({ title: `#${route.params.index}` })}
/>
<Stack.Screen
name="RepoPulls"
component={RepoPullsScreen}
options={{ title: t('repo.pullsTab') }}
/>
<Stack.Screen
name="PullDetail"
component={PullDetailScreen}
options={({ route }) => ({ title: `#${route.params.index}` })}
/>
</Stack.Navigator>
);
}