This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppComponent.js
55 lines (48 loc) · 1.64 KB
/
AppComponent.js
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
/** @format */
import React from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { ApplicationProvider, IconRegistry } from "@ui-kitten/components";
import { mapping, dark, light } from "@eva-design/eva";
import { EvaIconsPack } from "@ui-kitten/eva-icons";
import { AppearanceProvider } from "react-native-appearance";
import { StatusBar, Platform } from "react-native";
import { IonicIconsPack } from "./ionic-icons";
import { MaterialCommunityIconsPack } from "./material-icons";
import AppNavigator from "./navigation/Drawer";
import { default as lightTheme } from "./themes/custom-theme.json";
import { default as darkTheme } from "./themes/night-theme.json";
import { default as customMapping } from "./themes/custom-mapping.json";
const themes = { 1: { ...light, ...lightTheme }, 0: { ...dark, ...darkTheme } };
if (Platform.OS !== "ios") {
StatusBar.setHidden(true);
}
const AppComponent = ({ theme }) => {
return (
<>
<StatusBar
backgroundColor={theme ? "#ffffff" : "#383838"}
barStyle={theme ? "dark-content" : "light-content"}
/>
<IconRegistry
icons={[EvaIconsPack, IonicIconsPack, MaterialCommunityIconsPack]}
/>
<AppearanceProvider>
<ApplicationProvider
mapping={mapping}
theme={themes[theme]}
customMapping={customMapping}
>
<AppNavigator />
</ApplicationProvider>
</AppearanceProvider>
</>
);
};
AppComponent.propTypes = {
theme: PropTypes.any
};
const mapStateToProps = state => ({
theme: state.user.theme
});
export default connect(mapStateToProps, null)(AppComponent);