import React from 'react'; import AppLoading from 'expo-app-loading'; import { Ionicons } from '@expo/vector-icons'; import * as Font from 'expo-font'; // Redux + Storage import swimtrackerReducer from './state/Reducer'; import { createStore } from 'redux'; import { DeviceReduxCoupling } from './state/DeviceReduxCoupling'; import { Provider } from 'react-redux'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { persistStore, persistReducer } from 'redux-persist' import hardSet from 'redux-persist/lib/stateReconciler/hardSet' import { PersistGate } from 'redux-persist/integration/react' // Navigation import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; // Own views import MainMenuView from "./views/MainMenuView"; import SettingsView from "./views/SettingsView"; import TrainingView from "./views/TrainingView"; import LastSessionsView from "./views/LastSessionsView"; import ConnectingView from './views/ConnectingView'; import WifiSelectionView from './views/WifiSelectionView'; import WifiPasswordView from './views/WifiPasswordView'; const persistConfig = { key: 'root', storage: AsyncStorage, stateReconciler: hardSet, }; const persistedReducer = persistReducer(persistConfig, swimtrackerReducer) const store = createStore(persistedReducer); const persistor = persistStore(store); const Stack = createStackNavigator(); export default class App extends React.Component { constructor(props) { super(props); this.state = { isReady: false, }; } async componentDidMount() { /*await Font.loadAsync({ Roboto: require('native-base/Fonts/Roboto.ttf'), Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'), ...Ionicons.font, });*/ this.setState({ isReady: true }); this.device = new DeviceReduxCoupling(store); } render() { if (!this.state.isReady) { return ; } const screenOptions = { headerShown: false, }; /* return ( } persistor={persistor}> ); */ return ( } persistor={persistor}> ); } }