-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.tsx
56 lines (48 loc) · 1.75 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import "react-native-gesture-handler";
import React from "react";
import { StatusBar, useColorScheme, LogBox } from "react-native";
import SplashScreen from "react-native-splash-screen";
import { createStore, applyMiddleware, compose, combineReducers } from "redux";
import { Provider, useDispatch } from "react-redux";
import logger from "redux-logger";
import { composeWithDevTools } from "redux-devtools-extension";
import { QueryClient, QueryClientProvider } from "react-query";
/**
* ? Local Imports
*/
import Navigation from "./src/services/navigation";
import { isAndroid } from "@freakycoder/react-native-helpers";
import loading from "./src/shared/store/reducers/loading";
const queryClient = new QueryClient();
/* -------------------------------------------------------------------------- */
/* Redux Methods */
/* -------------------------------------------------------------------------- */
const enhancer =
process.env.NODE_ENV === "production"
? compose(applyMiddleware())
: composeWithDevTools(applyMiddleware(logger));
const rootReducer = combineReducers({
loading,
});
const store = createStore(rootReducer, enhancer);
const App = () => {
const scheme = useColorScheme();
const isDarkMode = scheme === "dark";
LogBox.ignoreAllLogs(true);
React.useEffect(() => {
StatusBar.setBarStyle(isDarkMode ? "light-content" : "dark-content");
if (isAndroid) {
StatusBar.setBackgroundColor("rgba(0,0,0,0)");
StatusBar.setTranslucent(true);
}
SplashScreen.hide();
}, [scheme]);
return (
<QueryClientProvider client={queryClient}>
<Provider store={store}>
<Navigation />
</Provider>
</QueryClientProvider>
);
};
export default App;