import {StyleSheet, View} from 'react-native'; import {NavigationContainer, useNavigation} from "@react-navigation/native"; import 'react-native-gesture-handler'; import {createStackNavigator} from "@react-navigation/stack"; import Home from "./screens/home"; import Login from "./screens/login"; import Event from "./screens/event"; import Notification from "./screens/notfication"; import {createBottomTabNavigator} from "@react-navigation/bottom-tabs"; import Database from './db' import TaskIconActive from "./assets/taskIconActive.svg"; import TaskIcon from "./assets/taskIconInactive.svg" import NotificationIconActive from "./assets/notificationActive.svg"; import NotificationIconInactive from './assets/notificationInactive.svg' import InputScreen from "./screens/InputScreen"; import TaskStore, {getTasks} from "./store/taskStore"; import {useSnapshot} from "valtio"; import {useEffect} from "react"; import {getSubtasks} from "./store/subtaskStore"; import NotificationStore, {getNotifications} from "./store/notificationStore"; import {getEvents} from "./store/eventStore"; const generateTabBarIcon = ({focused, style}) => { const styles = { taskIcon: { focused: , default: }, notificationIcon: { focused: , default: } } return !!focused ? styles[style].focused : styles[style].default } const Stack = createStackNavigator(); const Tab = createBottomTabNavigator(); const HomeStack = () => { return ( }/> ) } const MainNavigator = () => { const {newTaskBadge} = useSnapshot(TaskStore) const {newNotificationBadge} = useSnapshot(NotificationStore) return ( generateTabBarIcon({focused, style: "taskIcon"}), tabBarBadge: newTaskBadge === 0 ? undefined : newTaskBadge, }}/> generateTabBarIcon({ focused, style: "notificationIcon" }), tabBarBadge: newNotificationBadge === 0 ? undefined : newNotificationBadge } } /> ) } const LoginStack = () => { return ( ) } export default function App() { useEffect(() => { // All preloaded data // todo this functions should be called // background process getTasks(); // todo check to be sync getSubtasks(); getNotifications(); getEvents() setInterval(getTasks, 10000) setInterval(getSubtasks, 10000) setInterval(getNotifications, 10000) setInterval(getEvents, 10000) }, []); return ( ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, });