-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvaWrapper.tsx
77 lines (71 loc) · 3.22 KB
/
EvaWrapper.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import React, { PropsWithChildren } from "react";
import useSetting, { ThemeAtom } from "./hooks/useSetting";
import * as eva from "@eva-design/eva";
import { ApplicationProvider } from "@ui-kitten/components";
import * as themes from "./themes";
import { Platform } from "react-native";
const disabled = false;
export default disabled ? (({ children }: PropsWithChildren<{}>) => <>{children}</>) : function EvaWrapper({ children, dark }: PropsWithChildren<{dark?: boolean}>) {
const [themeValue] = useSetting(ThemeAtom);
const theme =
themeValue !== "generate" && themeValue in themes
? (themes as any)[themeValue.replace(dark ? /_lighter$/ : "_dark", "_dark")]
: themes.generate(themeValue);
return (
<ApplicationProvider
{...eva}
customMapping={
{
strict:
Platform.OS === "android"
? {
"text-heading-1-font-family": "sans-serif-regular",
"text-heading-1-font-weight": "700",
"text-heading-2-font-family": "sans-serif-regular",
"text-heading-2-font-weight": "700",
"text-heading-3-font-family": "sans-serif-regular",
"text-heading-3-font-weight": "700",
"text-heading-4-font-family": "sans-serif-regular",
"text-heading-4-font-weight": "700",
"text-heading-5-font-family": "sans-serif-regular",
"text-heading-5-font-weight": "700",
"text-heading-6-font-family": "sans-serif-regular",
"text-heading-6-font-weight": "700",
"text-subtitle-1-font-weight": "600",
"text-subtitle-1-font-family": "sans-serif-medium",
"text-subtitle-2-font-weight": "600",
"text-subtitle-2-font-family": "sans-serif-medium",
"text-paragraph-1-font-weight": "400",
"text-paragraph-1-font-family": "sans-serif",
"text-paragraph-2-font-weight": "400",
"text-paragraph-2-font-family": "sans-serif",
"text-caption-1-font-weight": "400",
"text-caption-1-font-family": "sans-serif",
"text-caption-2-font-weight": "600",
"text-caption-2-font-family": "sans-serif-medium",
"text-label-font-weight": "700",
"text-label-font-family": "sans-serif-regular",
}
: {
"text-heading-1-font-weight": "700",
"text-heading-2-font-weight": "700",
"text-heading-3-font-weight": "700",
"text-heading-4-font-weight": "700",
"text-heading-5-font-weight": "700",
"text-heading-6-font-weight": "700",
},
} as any
}
theme={eva.light}
// theme={theme}
>
{/* {Platform.OS === "web" && (
<style>{`*::-webkit-scrollbar {width: 8px;height:8px;}
*::-webkit-scrollbar-thumb {background-color: ${
theme.style === "dark" ? theme["color-basic-1100"] : theme["color-basic-400"]
};border-radius: 8px;}`}</style>
)} */}
{children}
</ApplicationProvider>
);
}