import './config/firebase';
import { StatusBar } from 'expo-status-bar';
import { useFonts } from 'expo-font';
import React, { useState, useEffect, useRef, useMemo } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Moment from 'react-moment';
import 'moment/locale/uk';
import DateSlider from './components/date_slider';
import LessonList from './components/lesson_list'
import AppLoading from 'expo-app-loading';
import Lessons from './components/data.json'
//export const IndexContext = React.createContext(0);
export default function App() {
const [loaded] = useFonts({
eUkraineBold: require('./assets/fonts/e-Ukraine/e-Ukraine-Bold.otf'),
eUkraineMedium: require('./assets/fonts/e-Ukraine/e-Ukraine-Medium.otf'),
eUkraineRegular: require('./assets/fonts/e-Ukraine/e-Ukraine-Regular.otf'),
});
const [index, setIndex] = useState(0);
const toggleIndex = () => setIndex(prev => index);
if (!loaded) {
return <AppLoading/>
}
return (
<View style={styles.container}>
<StatusBar style="auto" />
<View style={styles.today}>
<Moment element={Text} style={styles.today_day} format='D'></Moment>
<View style={styles.today_column}>
<Moment element={Text} style={styles.today_day_week} format='dddd'></Moment>
<Moment element={Text} style={styles.today_month_year} format='MMMM YYYY'></Moment>
</View>
</View>
<Text>{index}</Text>
<DateSlider data={Lessons} index={index} setIndex={setIndex} />
<LessonList data={Lessons} index={index} setIndex={setIndex} />
</View>
);
}
});