try to fix navigation some more.

This commit is contained in:
Jordan 2025-02-24 09:09:20 -08:00
parent c3d543be39
commit 6f941c56d1
3 changed files with 9 additions and 16 deletions

View File

@ -1,16 +1,11 @@
import * as React from 'react'; import * as React from "react";
import { NavigationContainer } from '@react-navigation/native'; import { NavigationContainer } from "@react-navigation/native";
import SettingsComponent from '@/components/Settings'; import TTNavStack from "@/components/TTNavStack";
import { LanguageSelection } from '@/components/LanguageSelection';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import ConversationThread from '@/components/ConversationThread';
import Home from '.';
import TTNavStack from '@/components/TTNavStack';
const Stack = createNativeStackNavigator();
export default function Layout() { export default function Layout() {
return ( return (
<TTNavStack /> <NavigationContainer>
<TTNavStack />
</NavigationContainer>
); );
} }

View File

@ -17,9 +17,9 @@ const Stack = createNativeStackNavigator();
export default function TTNavStack() { export default function TTNavStack() {
const nav = useNavigation<NativeStackNavigationProp<RootStackParamList, 'ConversationThread'>>();
async function onLangSelected(lang: language_matrix_entry) { async function onLangSelected(lang: language_matrix_entry) {
const nav = useNavigation<NativeStackNavigationProp<RootStackParamList, 'ConversationThread'>>();
const settings = await Settings.getDefault(); const settings = await Settings.getDefault();
const hostLanguage = await settings.getHostLanguage(); const hostLanguage = await settings.getHostLanguage();
const conversation = new Conversation( const conversation = new Conversation(
@ -31,7 +31,6 @@ export default function TTNavStack() {
} }
return ( return (
<NavigationContainer>
<Stack.Navigator initialRouteName='LanguageSelection'> <Stack.Navigator initialRouteName='LanguageSelection'>
<Stack.Screen name="LanguageSelection" > <Stack.Screen name="LanguageSelection" >
{ props => <LanguageSelection {...props} onLangSelected={(l) => onLangSelected(l)} />} { props => <LanguageSelection {...props} onLangSelected={(l) => onLangSelected(l)} />}
@ -39,6 +38,5 @@ export default function TTNavStack() {
<Stack.Screen name="ConversationThread" component={ConversationThread} /> <Stack.Screen name="ConversationThread" component={ConversationThread} />
<Stack.Screen name="Settings" component={SettingsComponent} /> <Stack.Screen name="Settings" component={SettingsComponent} />
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer>
); );
} }

View File

@ -7,5 +7,5 @@ export type RootStackParamList = {
LanguageSelection: undefined; LanguageSelection: undefined;
ConversationThread: undefined; ConversationThread: undefined;
Settings: undefined; Settings: undefined;
Conversation: { conversation: Conversation }; Conversation: { conversation?: Conversation };
}; };