import React, {useState} from 'react';
import Lottie from 'lottie-react-native';
import CartProvider from './src/store/CartContext';
import RootNavigation from './src/navigation';
import AuthContextProvider from './src/store/AuthContext';

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

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

  if (isLoading) {
    const img = require('./src/assets/splash_screen.json');
    return <Lottie source={img} autoPlay loop />;
  }
  return (
    <CartProvider>
      <AuthContextProvider>
        <RootNavigation />
      </AuthContextProvider>
    </CartProvider>
  );
}

export default App;
