import * as React from 'react';
import { useEffect } from 'react';
import { Provider } from 'react-redux';
import Routes from './navigation/Routes';
import { store } from './redux/store';
import { initTables } from './constants/database';
import { CreateImageFolders } from './constants/function';
import { GestureHandlerRootView } from 'react-native-gesture-handler';

function App() {
  useEffect(() => {
    initTables(); // Ensure DB tables are created
    CreateImageFolders();
  }, []);

  return (
     <GestureHandlerRootView style={{ flex: 1 }}>
      <Provider store={store}>
        <Routes />
      </Provider>
     </GestureHandlerRootView>
  );
}

export default App;
