import React, { useState } from 'react';
import Lottie from 'lottie-react-native';
import Home from './src/components/Home';
import Login from './src/components/Login';
import Signup from './src/components/Signup';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

const Stack = createNativeStackNavigator();

function App() {
  const [isLoading, setLoading] = useState(true);

  setTimeout(() => {setLoading(false)}, 6000);

  if (isLoading) {
    return (
      <Lottie source={require('./src/assets/splash_screen.json')} autoPlay loop />
    );
  }
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={Home} />
        <Stack.Screen name="Signup" component={Signup} />
        <Stack.Screen name="Login" component={Login} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;