import 'react-native-gesture-handler';
import React, {useEffect} from 'react';
import {
  SafeArea,
  SafeAreaView,
  ScrollView,
  StatusBar,
  StyleSheet,
  Text,
  useColorScheme,
  View,
} from 'react-native';

import {
  Colors,
  DebugInstructions,
  LearnMoreLinks,
  ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {enableScreens} from 'react-native-screens';
import RNBootSplash from 'react-native-bootsplash';
import HomeScreen from './components/HomeScreen';
import BottomTab from './components/BottomTab';
import RegisterUserScreen from './components/RegisterUserScreen';
import LoginUserScreen from './components/LoginUserScreen.js';
import SearchHouse from './components/SearchHouse.js';
import HouseProfile from './components/HouseProfile.js';
import UserProfile from './components/UserProfile.js';

const Section = ({children, title}): Node => {
  const isDarkMode = useColorScheme() === 'dark';
  return (
    <View style={styles.sectionContainer}>
      <Text
        style={[
          styles.sectionTitle,
          {
            color: isDarkMode ? Colors.white : Colors.black,
          },
        ]}>
        {title}
      </Text>
      <Text
        style={[
          styles.sectionDescription,
          {
            color: isDarkMode ? Colors.light : Colors.dark,
          },
        ]}>
        {children}
      </Text>
    </View>
  );
};

const Stack = createStackNavigator();

const App = () => {
  enableScreens();
  useEffect(() => {}, []);
  return (
    <NavigationContainer onReady={() => RNBootSplash.hide()}>
      <Stack.Navigator initialRouteName="BottomTab">
        <Stack.Screen
          name="BottomTab"
          component={BottomTab}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name="Test"
          component={HomeScreen}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name="LoginUserScreen"
          component={LoginUserScreen}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name="RegisterUserScreen"
          component={RegisterUserScreen}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name="SearchHouse"
          component={SearchHouse}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name="HouseProfile"
          component={HouseProfile}
          options={{headerShown: false}}
        />
        <Stack.Screen
          name="UserProfile"
          component={UserProfile}
          options={{headerShown: false}}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
};

export default App;
