
import * as React from 'react';
import { View, Text, Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import type { NativeStackScreenProps } from '@react-navigation/native-stack';

type RootStackParamList = {
  Home: undefined,
  Loby: undefined,
  Game: {gameId: string}
};

type HomeScreenProps = NativeStackScreenProps<RootStackParamList, 'Home'>;
type LobyScreenProps = NativeStackScreenProps<RootStackParamList, 'Loby'>;

function HomeScreen({ navigation, route }: HomeScreenProps) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Button 
        title='New Game'
        onPress={() => navigation.navigate('Loby')}></Button>
    </View>
  );
}

function LobyScreen({ navigation, route }: LobyScreenProps) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Loby Screen</Text>
    </View>
  );
}

const Stack = createNativeStackNavigator<RootStackParamList>();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Loby" component={LobyScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;